9
0
Fork 0
Commit Graph

1307 Commits

Author SHA1 Message Date
Sascha Hauer 3e503822c7 use loff_t for file offsets
This is a first step for 64bit file support: Make the file sizes/offsets
64bit.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2012-06-30 16:53:24 +02:00
Steffen Trumtrar f2bfcf98a1 common: fix typo cammand_var_complete
Change function name to command_var_complete in all calls and its declaration.

Signed-off-by: Steffen Trumtrar <s.trumtrar@pengutronix.de>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2012-06-30 12:47:04 +02:00
Sascha Hauer 527772ca0e partition: Use dma_alloc for allocating buffers
Drivers may use dma to transfer blocks, so put them into
dma save memory.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2012-06-30 12:46:25 +02:00
Sascha Hauer 9895357a71 block: use dma_alloc to allocate buffers
Drivers may use dma to transfer blocks, so put them into
dma save memory.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2012-06-30 12:46:25 +02:00
Sascha Hauer cdd4b4f075 dos partitions: enable disk size guessing only for bios disks
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2012-06-28 12:45:39 +02:00
Sascha Hauer 01f8ce581b menu: factor out a function to print an entry
To save a few bytes of binary space.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2012-06-28 12:45:19 +02:00
Krzysztof Halasa edfe50ce40 Fix a panic in crypto hash calculations due to uninitialized variable.
Signed-off-by: Krzysztof Hałasa <khc@pm.waw.pl>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2012-06-07 19:39:09 +02:00
Alexander Shiyan 71d559854e block: Fix printf warning
Signed-off-by: Alexander Shiyan <shc_work@mail.ru>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2012-05-31 20:21:19 +02:00
Sascha Hauer ff6bacd6f4 block: do not BUG() on failed block_get
It does not necessarily means a bug when block_get fails here,
this can also be a failure on the underlying device.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2012-05-30 06:03:01 +02:00
Sascha Hauer 949b03dfb1 block: propagate error code from block_get
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2012-05-30 06:01:02 +02:00
Sascha Hauer 169a770faf hush: do not convert to return code too early
parse_stream_outer used to convert a exit value to a return code,
but parse_stream_outer maybe inside a recursion. This means that
the exit status is lost in this case. Test case:

if [ 0 = 0 ]; then
	false
	exit $?
fi

echo "shouldn't be here"

Without this patch "shouldn't be here" will be printed.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2012-05-23 16:12:50 +02:00
Sascha Hauer 10ea54dc50 Merge branch 'pu/hush' into next 2012-05-23 16:11:39 +02:00
Alan Ott a9eef6a7b9 common: Make MENU depend on PROCESS_ESCAPE_SEQUENCE
print_menu_entry() in common/menu.c depeneds on process_escape_sequence().

Signed-off-by: Alan Ott <alan@signal11.us>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2012-05-21 22:03:50 +02:00
Sascha Hauer 9448aa57ec run_shell: run again on ctrl-c
We can start a new interactive shell now using the 'sh' command on
the command line. This shell exits on ctrl-c though. Add a loop
around it to continue instead of exiting.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2012-05-21 09:08:29 +02:00
Sascha Hauer 0e8155229a Add next generation default environment template
This adds a new environment template which aims to be more flexible
and configurable. Instead of having mainly two scripts (a config script
and a boot script) this template uses initscripts which control the
startup behaviour and configuration. Also we have boot scripts in
/env/boot which configure a single boot configuration. Additional
boot entries can be added by board specific entries or during runtime
by copying and editing a template entry.

Some more helpers handle for example network interfaces which can now
be brought up with 'ifup'. We use the automount feature to configure
mountpoints together with the commands to bring up the devices behind
these mountpoints.

Optionally menu support is available which hides many details behind
a nice looking interface.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2012-05-18 12:26:52 +02:00
Sascha Hauer e741110f5a Merge branch 'master' into next 2012-05-16 20:23:44 +02:00
Sascha Hauer 3f66e8dc57 Merge branch 'pu/magicvar' into next 2012-05-15 20:34:34 +02:00
Sascha Hauer 69ee684695 flexible bootargs: Add magicvar descriptions
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2012-05-15 09:05:57 +02:00
Sascha Hauer 91c38de28f glob: Add sorted output support
This allows us for example to execute init scripts in the correct
order.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2012-05-14 20:16:44 +02:00
Sascha Hauer ee4cab9e58 booting: more flexible Linux bootargs generation
We currently use the environment variable 'bootargs' to get the
Linux bootargs. This patch allows for a more flexible bootargs
generation using global variables. With it the Linux bootargs
are concatenated from multiple variables. This allows to replace
parts of the bootargs string without having to reconstruct it
completely.
With this bootargs can be constructed like:

global linux.bootargs.base="console=ttyS0,115200"
global linux.bootargs.ip="ip=dhcp"
global linux.mtdparts="physmap-flash.0:512K(nor0.barebox),-(root)"

This will then automatically be combined into a kernel bootargs
string during boot.

If the 'linux.bootargs.' variables are all empty the old standard
'bootargs' way will be used.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2012-05-14 09:16:31 +02:00
Sascha Hauer b8c94a1561 add 'global' command
This implements global shell variable support. This is done by registering
a new device named 'global', so global variables are just plain device
parameters.
Global variables are useful for storing the global state in the environment.
Currently we do this by sourcing scripts instead of executing them which is
quite limiting.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2012-05-14 08:57:01 +02:00
Sascha Hauer 6188685091 Make errno a positive value
Normally errno contains a positive error value. A certain unnamed developer
mixed this up while implementing U-Boot-v2. Also, normally errno is never
set to zero by any library function.
This patch fixes this.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2012-05-14 08:35:54 +02:00
Antony Pavlov 87b302f4e2 MIPS: bootm: add "MIPS barebox" handler
Signed-off-by: Antony Pavlov <antonynpavlov@gmail.com>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2012-05-11 09:05:11 +02:00
Jean-Christophe PLAGNIOL-VILLARD 7e88b6c7f1 complete: fix duplicate env eval list
this can be reproductable by this sequence

barebox:/ <TAB>
.                  ?                  [                  addpart
bootm              cat                cd                 clear
cp                 cpuinfo            crc32              delpart
devinfo            dhcp               echo               edit
erase              ethact             exit               export
false              getopt             go                 help
host               loadb              loadenv            loady
login              ls                 md                 md5sum
memcmp             memcpy             meminfo            memset
menu               mkdir              mount              mtest
mw                 nfs                passwd             ping
printenv           protect            pwd                readline
reset              rm                 rmdir              saveenv
sedit              sh                 sha1sum            sha256sum
sleep              source             test               tftp
time               timeout            true               umount
uncompress         unprotect          version            net.nameserver=
net.domainname=    cs0.baudrate=      cs0.active=        cs1.active=
cs1.ip=            cs1.port=
barebox:/ $<TAB>
$net.nameserver     $net.domainname     $cs0.baudrate
$cs0.active         $cs1.active         $cs1.ip
$cs1.port           $net.nameserver     $net.domainname
$cs0.baudrate       $cs0.active         $cs1.active
$cs1.ip             $cs1.port
barebox:/ $

Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2012-05-03 20:11:51 +02:00
Sascha Hauer ce38019845 Merge branch 'next'
Conflicts:
	common/hush.c

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2012-05-03 20:10:13 +02:00
Sascha Hauer 61eb23d44e uimage/file_to_sdram: fix resource allocation
file_to_sdram is used to load an initrd. The resource size is
then used to pass the initrd size to Linux. This means that
the resource size must exactly match the initrd size. Currently
this is not the case since we request the sdram region in chunks
of 8 Kbytes. Fix this by adjusting the resource size when the file
is loaded.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2012-05-02 10:37:52 +02:00
Sascha Hauer ebde5ae5ac hush: bail out of scripts on syntax error
On a systax error we have to bail out of the shell instead of
setting inp->p to NULL and crash barebox with a NULL pointer
deref. This only happened in scripts.

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

This fixes the problem I had (i.e. a boot loop caused by a stray fi in
/env/bin/init).

Reported-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
Tested-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
2012-05-02 10:37:33 +02:00
Sascha Hauer e4e3fbd22b improve complete support
The following patch serie improve the complete support
 by adding a complete framework to aalow commands complete support.
 
 The add also car complete support for eval and setting and executable
 file support
 
 This also include an update of the stringlist API to support asprintf
 API
 -----BEGIN PGP SIGNATURE-----
 Version: GnuPG v1.4.12 (GNU/Linux)
 
 iQIcBAABAgAGBQJPnohsAAoJEOrjwV5ZMRf2qeIQAIC7WrIao0mB2pIB+51MqeU+
 sof7GLxUl0MWXFFc3OFEHDcY5grC867mBmB9+uDG1mvcxa/bUpw+jMRMrki5j4Kg
 mjaHQ2UCvDjMHqQi7ISc/WTyJb09mtduFIceP0EftAmG8Mb5n9XOMaKwL9r/UQHB
 ps9MijnI/QeFqbrmBZcuaCp59QsPvipYw8NMJITBu2VvWrpKTIox33qPfNATDuEV
 SzMoLwz+uD7W7dEAM/A1uFdo4K5fLyZruDVGQoQ8CRS+zW3E6rr/EakpN5mhr/66
 dVZYO1xWppBaefIJQ1RD6bvwlFvesuuvQmMtDxsCsp07fyBolEWfFzblrwdkbueY
 NPwWExV5nzbRdAKKSyhU/nHiQ2edOQQZtHDAbnM4zh5e6lK7YLrzVklzT4Dfhzn0
 GRdnjCmiQiaZdmAEHe8wte2nr3Lc01fTsj/EFVA+LYP3a9by1iG2Zn3/ChieVcN4
 R+o/2lMBdhxsTszcmwMOemdqVPlt/0VmEXrKGtjTIZEViuQyyhY8ZtEaf4C0zeln
 Jf60t0ZvkehAJc0Lo4UOygjzvErqcKoHMk7utAjP+bi1KcMgF3Q+HmtCnJJs2FHw
 c40FZj1WcLPStEiS1way7miBakxOy2zPumKi1OXx+140L25C1nvQPYu8ilOZHEyU
 opNlo+wQ8h5sG/054kYL
 =rYfw
 -----END PGP SIGNATURE-----

Merge tag 'complete_update_support' of git://git.jcrosoft.org/barebox into next

improve complete support

The following patch serie improve the complete support
by adding a complete framework to allow commands complete support.

The add also car complete support for eval and setting and executable
file support

This also include an update of the stringlist API to support asprintf
API
2012-05-01 21:41:59 +02:00
Sascha Hauer 4023588064 Merge branch 'pu/assorted' into next 2012-05-01 21:40:07 +02:00
Sascha Hauer 55d88805ed Master Fixes
usb driver name (driver_d)
 
 Menu fixes
 -----BEGIN PGP SIGNATURE-----
 Version: GnuPG v1.4.12 (GNU/Linux)
 
 iQIcBAABAgAGBQJPl9TDAAoJEOrjwV5ZMRf24wEP/2fTLxK0JpnxcqurzOV7lySQ
 xZQLU4PoQDilYoZBlsAleyIifeeU1w2fA6mrvAE3aN822225S1pqDLNTEQBo/GRZ
 hbLACOHkpw8VbJ5PmmxXYx6m6+lGMNrAltYPks6C1m/0SdIQGfHk+YjcaucpZGnU
 CwUDS7ZMDRQo+gXNMMjVFpC0DCHVwlBpkedGXxAArrcr1wx3NAyKzapymUQtPplj
 A4NtDpFhoCyVIffZs61qIppLxx8D/9zR+nZUhULAD/3px4mnBt771X0OxY9ngzik
 YmV0VU9C1w1LRlArKIvt+CQQZ84Plks7hekrVIMPIVB15v5unNDTxlQqJvRJw+Oy
 UZGt8z2nDbcMPx1viz6G877/Aa3EmN16O1/1+U20IPVsXbfB6k1wNXJ8t96HSgLD
 WV1KhmxoXfSASQr6INBRCtmnQ9/mfbXRci6i7CfAOh01YoVWG/xlpPl7iagFk/Cl
 xa6R+Ym71bRQnkhVffLseb9/bWuxzm+LH3aom6TMHV9N3PnztuqiM+q0VcbPkIL4
 7ip29YoGV5WoV9Wf2oJKABGWADLxbFXUso++fcdWtmrTX7AVOkWjz+VQvITmDfAM
 iXM1e2Kwgi/uaAZMP3GDxrkvZwtj5UXc0SakGJJyMJ1v4GhWhlI7db05LR4bGfR5
 AyHRr4OvyQid4YFA366I
 =/CNm
 -----END PGP SIGNATURE-----

Merge tag 'j-master-fixes' of git://git.jcrosoft.org/barebox

Master Fixes

usb driver name (driver_d)

Menu fixes
2012-04-30 15:11:08 +02:00
Jean-Christophe PLAGNIOL-VILLARD 9492976bc8 complete: add executable file support
Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
2012-04-30 20:37:40 +08:00
Jean-Christophe PLAGNIOL-VILLARD c43a087718 complete: add go and sleep support
Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
2012-04-30 20:37:40 +08:00
Jean-Christophe PLAGNIOL-VILLARD 8e6f45f54f complete: add empty complete support
for cpuinfo, clear, dhcp, false, login, lsmod, meminfo, passwd, pwd, reginfo,
reset, true, usb, version

for mach-imx and mach-mxs: dump_clocks
for u_serial: mycdev

Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
2012-04-30 20:37:40 +08:00
Jean-Christophe PLAGNIOL-VILLARD 1fa17ad5d4 complete: add device name complete support for devinfo
Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
2012-04-30 20:37:34 +08:00
Jean-Christophe PLAGNIOL-VILLARD 9dfb0030ee complete: add generic command complete framework
introduce generic command specific complete callback

Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
2012-04-30 20:29:50 +08:00
Jean-Christophe PLAGNIOL-VILLARD c3d60e6df3 complete: add var and device param complete support
with $xx or xx= or if device $xx.yy or xx.yy=

Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
2012-04-30 20:22:24 +08:00
Sascha Hauer e652753f95 tlsf_malloc: return valid pointer for malloc(0)
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2012-04-30 13:31:29 +02:00
Sascha Hauer 47f8cf2d08 remove dlmalloc.src
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2012-04-30 13:28:36 +02:00
Sascha Hauer e21a340e39 hush: allow to run interactive shell in do_sh
This allows to call 'sh' in scripts without arguments in which
case an interactive shell will be started.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2012-04-30 13:08:55 +02:00
Sascha Hauer f034ed2044 hush: Fix globbing
hush has a long standing and anoying glob bug. hush expands wildcards
during parsing of the script or command stream. When the command stream
begins to execute the wildcards are already expanded which leads to:

mkdir /tmp
cd /tmp
mkdir foo; ls *
ls: *: No such file or directory

To fix this expand wildcards right before executing the command. Since
'for' loops are not executed in commands, we have to keep the old behaviour
in here so that 'for i in *' still works.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2012-04-30 13:08:55 +02:00
Sascha Hauer f4762eb5e7 hush: pass GLOB_NOCHECK to glob
By doing so glob will not return GLOB_NOMATCH anymore but instead
just does what fake_glob would do.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2012-04-30 13:08:55 +02:00
Sascha Hauer 87681170f5 hush: simplify globhack
hush used to escape '*' '[' '?' during parsing because the quotes
got removed in the first parsing loop.

globhack is used to remove these escapes again for glob. Since we now
keep the quotes until the end of parsing and we no longer escape glob
wildcards, we do no longer have to remove any quotes. With this globhack
can be much simpler.

While at it, change the prototype to match the one from glob() and rename
the function to fake_glob, because that's what it is: it just copies the
input string into the output struct without actually globbing.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2012-04-30 13:08:54 +02:00
Sascha Hauer 1aad6d033a hush: remove quotes at end of processing
hush removes the quotes from strings too early. This leads to some bugs.
When hush executes

echo "hello sascha"

it correctly results in:

argv[0] = "echo"
argv[1] = "hello sascha"

However, the following behaves incorrect:

a="hello sascha"
echo "$a"

results in:

argv[0] = "echo"
argv[1] = "hello"
argv[2] = "sascha"

This is because hush removes the quotes and inserts variable values in a
single loop, so

echo "$a"

becomes:

echo hello sascha

after the loop.

Instead, keep the quotes until all variables are inserted and remove them
at the end.

This also fixes that echo \" resulted in \" instead of ".

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2012-04-30 13:08:54 +02:00
Sascha Hauer 37e77d3cfe hush: run_pipe_real: bail out early to safe an indention level
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2012-04-30 13:08:54 +02:00
Sascha Hauer 162e2a820d hush: run_pipe_real must have num_progs == 1
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2012-04-30 13:08:54 +02:00
Sascha Hauer 86c031783f hush: remove bogus 'else'
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2012-04-30 13:08:54 +02:00
Sascha Hauer 3996c942f2 hush: cleanup coding style
General coding style cleanup

- add some blank lines
- add whitespaces on on both sides of operators

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2012-04-30 13:06:46 +02:00
Sascha Hauer b1c5b646b3 hush: safe an indention level by continueing a loop
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2012-04-30 13:06:43 +02:00
Sascha Hauer 8c3cc9621f hush: safe indention level by continueing a loop
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2012-04-30 13:04:49 +02:00
Jean-Christophe PLAGNIOL-VILLARD eb7667b681 menu: fix support for "\n", "\n\r" and "\r"
If "\n\r" or "\r\n" is ignore one.

Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
2012-04-25 18:37:41 +08:00
Jean-Christophe PLAGNIOL-VILLARD 38f9300444 menu: fix double action when "\n\r" or "\r\n" is received
Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2012-04-25 18:37:34 +08:00
Marc Kleine-Budde 78312fa0c5 common: memory: fix off-by-one in tlsf_create
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2012-04-24 15:19:29 +02:00
Jean-Christophe PLAGNIOL-VILLARD 9851c9cc87 menu: fix support for "\n", "\n\r" and "\r"
If "\n\r" or "\r\n" is ignore one.

Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
2012-04-23 19:51:06 +08:00
Jean-Christophe PLAGNIOL-VILLARD 071ceba1e3 Introduce binfmt support
This will allow to execute any file and detect it's type to handle it.
This will allow to use shell for bootp bootfile or dfu.

You can register multiple hook for the same filetype. They will be execute
in the invert order of register. If a hook does not handle the file you just
return -ERESTARTNOHAND;

This is only available with hush parser.

Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
2012-04-18 20:14:12 +08:00
Jean-Christophe PLAGNIOL-VILLARD 733d85510c filetype: add Bourne Shell support
Put it at first as it's the most likely to detect

Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
2012-04-18 19:53:08 +08:00
Sascha Hauer 3170433558 Merge branch 'master' into next 2012-04-17 22:05:37 +02:00
Sascha Hauer a9ba821609 filetype: Make it work on files < 512 bytes
This is a brown paper bag type of bugs. Do not assume that a file
has to be at minimun 512 bytes to be detectable.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2012-04-17 21:31:47 +02:00
Sascha Hauer 86b9eb2105 Merge branch 'work/dns' into next 2012-04-16 11:34:41 +02:00
Sascha Hauer abe4560c8a Use DEVICE_ID_DYNAMIC where applicable
We now have DEVICE_ID_DYNAMIC for dynamic allocation of device ids,
Use it where applicable.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2012-04-16 09:43:02 +02:00
Sascha Hauer 239a852336 Merge branch 'work/build-timestamp' into next 2012-04-16 09:39:16 +02:00
Jean-Christophe PLAGNIOL-VILLARD 6f9eaaa000 menu: enable the fancy color support only if HUSH is enabled
So we can use the menu for the xloader too.

Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2012-04-15 18:29:52 +02:00
Sascha Hauer 55c81081e5 Makefile: fix build timestamps
This patch adds the scripts/mkcompile_h from the Kernel. This gives
us additional information about the build like who built this binary
and with which compiler. Currently the only information used is the
build timestamp and the generation number.
This also fixes the build timestamp in the banner which is now correct
even with consecutive builds without making clean in between.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2012-04-15 15:18:17 +02:00
Sascha Hauer d13f42dd3c console simple: return with a proper error value
There can be only one console for console_simple, so
return with -EBUSY when the second gets registered.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2012-04-13 16:56:15 +02:00
Sascha Hauer afb03d7a55 make building of bareboxenv-target optional
The bareboxenv script build for the target does not work on
all architectures, so make it optional.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2012-04-13 12:36:38 +02:00
Jean-Christophe PLAGNIOL-VILLARD f3d1525337 filetype: add Android boot image support
Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2012-04-12 11:54:35 +02:00
Jean-Christophe PLAGNIOL-VILLARD 4da4b4df10 menu: add color fancy support
You can now use AINSI color in the display of the menu or menu_entry.
As the length of the string is not any more the same as the display simplify
the invertion display managemnent.

We just now invert the fontground and backgound on the string itself as done
in Kconfig.

Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2012-04-10 10:00:07 +02:00
Jean-Christophe PLAGNIOL-VILLARD 6da43a09a9 menu: fix double action when "\n\r" or "\r\n" is received
Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2012-04-10 10:00:07 +02:00
Sascha Hauer d94579abaf hush source: expand $PATH
The behaviour of other shells suggest that with source or '.'
the path should be resolved using the PATH environment variable. Do
the same in barebox.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2012-03-18 15:03:31 +01:00
Sascha Hauer beb36c510b Merge branch 'work/thumb2' into next 2012-03-06 09:39:59 +01:00
Sascha Hauer 104a6a7ccf ARM: Allow to compile in thumb-2 mode
This shrinks the resulting binary size by ~25%. Exceptions
are still handled in arm mode, so we have to explicitely
put .arm directives into the exception code. Thumb-2 mode
has been tested on i.MX51 Babbage board.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2012-03-06 09:37:59 +01:00
Sascha Hauer 33d1cc4bf2 commands: remove struct command pointer from commands
This is unused in all commands and thus can be removed.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2012-02-27 20:28:07 +01:00
Sascha Hauer d59925b8fb command: do not allow abbreviated commands anymore
abbreviated commands are derived from U-Boot and are only
partly useful. Noone expects from a shell to support this,
also we have tab completion. They also have some funny
side effects. For example we have a 'time' command. If this
command is not compiled in, the time command is interpreted
as an abbreviated version of the 'timeout' command. So remove
support for abbreviated commands and safe the binary space.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2012-02-27 20:08:09 +01:00
Sascha Hauer aed0e6ba03 getopt: save and restore context
execute_command is the single point where commands are executed and thus a new
getopt context is needed. currently we call getopt_reset here to reset the
context. This breaks though when a command tries to run a command itself by
calling execute_command or run_command.  In this case we have to store the
context and restore it afterwards. The same is necessary in builtin_getopt.
Currently noone does this so this one shouldn't fix a bug, but merely allows
us to do such things later.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2012-02-27 19:53:47 +01:00
Sascha Hauer a9236dd6b5 console: use container_of instead of type_data
This reduces the usage of type_data.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2012-02-25 15:16:14 +01:00
Sascha Hauer 16babe2c7f add string for -ETIMEDOUT
-ETIMEDOUT is a common error value, so print the string rather
than just the number.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2012-02-19 18:51:03 +01:00
Sascha Hauer 3ac63c6388 make uimages work on tftpfs
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2012-02-19 18:51:03 +01:00
Sascha Hauer 2546c5a514 Merge branch 'pu/device-cleanup' into next 2012-02-17 10:27:31 +01:00
Sascha Hauer 80b767748b dos partitions: Do not register as fixed partitions
A fixed partition means that we can't remove it. This is only suitable
for our vital /dev/self0 and /dev/env0 partitions, so remove the fixed
flag.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2012-02-17 10:27:15 +01:00
Sascha Hauer 06f66dc054 Merge branch 'pu/block' into next 2012-02-17 10:25:24 +01:00
Jean-Christophe PLAGNIOL-VILLARD 1f22d10f15 readkey: add define for Ascii keys
this will simplify the usage of gpio keyboard

Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
2012-02-16 18:17:32 +08:00
Sascha Hauer e3a9e1fd62 block: reimplement caching
The current caching layer only has a single buffer for
writing and reading. The FAT driver often accesses the
fat and then data again, which currently can't be cached.
Reimplement this with a list of cached chunks. The number
of chunks and their sizes are currently hardcoded, but
that could be easily made configurable.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2012-02-15 08:21:43 +01:00
Sanjeev Premi 21ea9e0f54 Select CMD_LOADENV with DEFAULT_ENVIRONMENT
The environment isn't loaded until this command is
is selected - even if compiled in.

This patch makes the dependency explicit.

Signed-off-by: Sanjeev Premi <premi@ti.com>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2012-02-07 23:17:43 +01:00
Sascha Hauer 192d6fe9be Merge branch 'pu/debug' into next 2012-01-27 09:31:13 +01:00
Sascha Hauer 641dfaa3a8 startup: use regular debug statements in initcall debugging
Now that we don't need malloc for the console anymore it's
safe to call printf anytime, so switch the initcall debugging
to regular debug() statements..

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2012-01-26 14:12:04 +01:00
Sascha Hauer 6d2ac13be0 initcalls: do not hang if an initcall fails
Currently we just hang when an initcall fails. This resulted
in most initcalls just returning 0 unconditionally. Instead
of hanging which usually leaves the user without a clue what
happened just continue and hope for the best.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2012-01-26 14:05:28 +01:00
Sascha Hauer 64a46e2217 console: make it work without malloc
This changes the dynamically allocated kfifos to statically initialized
ones. This makes the console work without malloc and thus safe to be
called before malloc is initialized.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2012-01-26 13:59:20 +01:00
Jean-Christophe PLAGNIOL-VILLARD 463229490e introduce barebox_bare_init_size to known the bare_init size and check it
this allow to check we do not exceed the size of the SRAM as example

introduce BAREBOX_MAX_BARE_INIT_SIZE the maximum size of bare_init
this will allow your bare_init will fit in SRAM as example
ARCH can overwrite it via ARCH_BAREBOX_MAX_BARE_INIT_SIZE

Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2012-01-23 09:43:28 +01:00
Jean-Christophe PLAGNIOL-VILLARD 064beaa73b add config to check if the size of barebox exceed the target size
CONFIG_BAREBOX_MAX_IMAGE_SIZE will allow to detected silent oversize result

Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2012-01-17 18:48:54 +01:00
Jean-Christophe PLAGNIOL-VILLARD 971d164f62 param: add config to disable it
this will allow to save 992 Bytes for TI xlaoder or AT91 bootstrap

Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
2012-01-11 21:22:34 +08:00
Jean-Christophe PLAGNIOL-VILLARD 507319e13b filetype: add config to disable it
remove 160 bytes

Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
2012-01-11 21:22:34 +08:00
Jean-Christophe PLAGNIOL-VILLARD b7498fdb82 banner: add config to disable it
this will allow to save 144 bytes

Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
2012-01-11 21:22:34 +08:00
Jean-Christophe PLAGNIOL-VILLARD 77b1e27530 dummy_malloc: add calloc support
needed to use menu framework

Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2012-01-11 09:36:30 +01:00
Jean-Christophe PLAGNIOL-VILLARD 4c4fae147d poller_call: move from getc to is_timeout
this will allow to always call poller_call even durring timeout
and still the case in getc

Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2012-01-04 14:10:13 +01:00
Sascha Hauer 2071c5dcfb Merge branch 'pu/tlsf' into next 2012-01-03 09:39:16 +01:00
Jean-Christophe PLAGNIOL-VILLARD 26927bafde defaultenv: use a compressed version when embedded in barebox
enable it only if a compression is enabled
support gzip, bzip2 and lzo

you will be able to choose which compression to use

-rw-r--r--  1 root root    8436 Dec 15 01:35 barebox_default_env
-rw-r--r--  1 root root    2782 Dec 15 01:35 barebox_default_env.bz2
-rw-r--r--  1 root root    2691 Dec 15 01:38 barebox_default_env.gz
-rw-r--r--  1 root root    3262 Dec 15 01:38 barebox_default_env.lzo

with using gzip and the default env we can save 5.6KiB (5,745 bytes)
with using bzip2 and the default env we can save 5.5KiB (5,654 bytes)
with using lzo and the default env we can save 5.1KiB (5,174 bytes)

Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2012-01-02 11:47:49 +01:00
Sascha Hauer c09fdea2c0 tlsf: remove unused stuff from tlsfbits.h
Also, as this file is locally used by the tlsf implementation,
move this file to common.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2011-12-23 11:29:10 +01:00
Sascha Hauer 5d96cda944 tlsf: implement malloc_stats
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2011-12-23 11:29:10 +01:00
Sascha Hauer 2467c61b3b tlsf: enable assertions
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2011-12-23 11:29:10 +01:00
Antony Pavlov b25bb1f072 add tlsf-based malloc implementation
Signed-off-by: Antony Pavlov <antonynpavlov@gmail.com>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2011-12-23 11:26:42 +01:00
Antony Pavlov 282af094a6 adapt tlsf for barebox
Signed-off-by: Antony Pavlov <antonynpavlov@gmail.com>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2011-12-23 11:26:42 +01:00
Antony Pavlov d5b733a644 import TLSF 2.0 from http://tlsf.baisoku.org/tlsf-2.0.zip
TLSF: Two Level Segregated Fit memory allocator implementation.
Written by Matthew Conte (matt@baisoku.org).
Public Domain, no restrictions.

Signed-off-by: Antony Pavlov <antonynpavlov@gmail.com>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2011-12-23 11:26:42 +01:00
Alexander Aring 56d0d5012f auto-completion: add auto-completion for path files
Add auto-completion for path files.

Signed-off-by: Alexander Aring <a.aring@phytec.de>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2011-12-21 12:38:14 +01:00
Sascha Hauer d9d9c41f77 move code now only used in mkimage to mkimage
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2011-12-15 11:07:15 +01:00
Sascha Hauer cbf041c630 remove now unused uImage code
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2011-12-15 11:07:15 +01:00
Sascha Hauer 390249968c reimplement uImage code
Provide a new API for accessing uImages which makes it easy
for commands to open images, verify them, load to (free) sdram
regions and show information about uImages.

- We now do not load the image to malloced space anymore.
- The data in the header is now stored in cpu native endianess
  after uimage_open which makes it easy to access the header data.
- uImage can be loaded to dynamically allocated sdram regions.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2011-12-15 10:59:35 +01:00
Sascha Hauer 9c11a31ce2 filetype: Add oftree detection
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2011-12-15 10:20:09 +01:00
Sascha Hauer 56442bb101 oftree: add of_fix_tree()
Currently we have of_get_fixed_tree() which assumes that
there is a global variable holding a oftree. This seems
not very flexible, so for now introduce a of_fix_tree()
which takes an fdt_header as argument and walks the
list of registered of fixup functions.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2011-12-15 10:18:14 +01:00
Sascha Hauer a746f4685a remove old ft_build support
This is unused now as its only user (ppc) is switched to
libfdt based oftree support"

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2011-12-14 13:40:17 +01:00
Antony Pavlov f17b9efcf7 fix "no previous prototype for 'sbrk'" warning
Signed-off-by: Antony Pavlov <antonynpavlov@gmail.com>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2011-12-09 10:43:25 +01:00
Sascha Hauer 083b3bd52a make dos partition support default yes if we have disk partition support
DOS partitions are the only partitions we handle at the moment
and without it most MMC/SD enabled configs are useless, so make
it default yes. Also, use 'depends on' instead of 'if'

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Acked-by: Juergen Beisert <jbe@pengutronix.de>
2011-12-07 17:46:17 +01:00
Sascha Hauer 9792a4302b ft_build: temporarily disable bootm oftree support
We do not have any command line parser support for bootm anymore.
Disable it for now to at least be able to compile it.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2011-12-07 13:07:46 +01:00
Sascha Hauer 4430b1a6fc console_simple: fix compiler warning
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2011-12-07 13:05:54 +01:00
Sascha Hauer 7e3a33198a memory: do not try to reserve iomem on sandbox
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2011-12-07 13:04:25 +01:00
Sascha Hauer 0ee6847f7b Merge branch 'next' 2011-12-07 12:03:13 +01:00
Sascha Hauer a2792b03ff fprintf: remove unused variable
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2011-12-07 11:44:37 +01:00
Sascha Hauer ab6dc1d297 console_simple: Fix compilation
Since fprintf and console_puts now return the number of
character written the prototypes have changes. We forgot
to fix console_simple which now fails to compile with:

common/console_simple.c:48:6: error: conflicting types for 'fprintf'
include/stdio.h:57:5: note: previous declaration of 'fprintf' was here
common/console_simple.c:67:6: error: conflicting types for 'console_puts'
include/stdio.h:20:5: note: previous declaration of 'console_puts' was here

Fix this by returning the proper numbers of characters written.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2011-12-07 10:55:19 +01:00
Robert Jarzmik ea8314d19f console: add console unregistering
Some console are transient, like the USB connected serial
console which should be removed when the USB connection is
severed.

Enable console removal for such devices.

Signed-off-by: Robert Jarzmik <robert.jarzmik@free.fr>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2011-12-05 17:59:02 +01:00
Sascha Hauer ec8dd25428 register sdram as resources
Also, request the sdram regions used by the barebox binary,
bss, malloc space and stack.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2011-12-04 22:26:07 +01:00
Sascha Hauer 200ae6b4ee add resource management functions
It is time to track our memory usage. Add a simple resource
management.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2011-12-03 10:09:29 +01:00
Sascha Hauer b6996039f6 add file detection support
Several filetypes can be autodetected. Barebox could make use
of this in several ways:

- Add a command to detect filetypes
- detect arm zImages and uImages to unify the different boot commands
- maybe detect UBI or JFFS2 images to construct parts of the kernel
  command line
- select correct uncompression function based on filetype

This patch adds basic support to detect filetypes.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2011-11-29 21:12:42 +01:00
Sascha Hauer 72bdddcca3 bootm: fix various memory leaks
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2011-11-29 20:55:50 +01:00
Sascha Hauer a94db01cdc introduce some env helpers
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2011-11-29 20:55:50 +01:00
Sascha Hauer ac4854be5e factor out iminfo command
The rests of U-Boots iminfo command are sitting in commands/bootm.c and
are in a nonusable state. Factor it out to its own file and make it work
again.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2011-11-29 20:55:50 +01:00
Sascha Hauer 7631e76c0b Merge branch 'work/magicvars' into next 2011-11-29 20:52:03 +01:00
Sascha Hauer 76dca8279e hush: Add magicvars
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2011-11-29 20:51:32 +01:00
Sascha Hauer e0f4fb2c98 Merge branch 'master' into next
Conflicts:
	drivers/ata/disk_drive.c

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2011-11-29 20:45:23 +01:00
Juergen Beisert 967a2675ba DISK: Add common partition handling for disk like media
This covers disk like media like SD card, CF cards, regular hard disks and also
USB mass storage devices. Most common used partition table is still of DOS type.
This implementation is prepared to support more partition types in the future.

Signed-off-by: Juergen Beisert <jbe@pengutronix.de>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2011-11-28 09:23:24 +01:00
Jean-Christophe PLAGNIOL-VILLARD 03d4554577 password: remove not used variable 'second'
Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2011-11-22 21:04:32 +01:00
Sascha Hauer 82c6ac9e07 Merge branch 'sent/assorted-fixes' 2011-11-17 22:59:47 +01:00
Sascha Hauer 1533f6b7b3 fix fprintf prototype and return value
The puts functions now properly return the number of characters
written. With this we can also fix fprintf.
Also, remove never reached return in fputs.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2011-11-11 16:19:48 +01:00
Sascha Hauer 8fe1e8fd41 console: fix return values of puts functions
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2011-11-11 12:20:21 +01:00
Sascha Hauer 90fee398bc export: do not fail on already exported variable
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2011-11-09 11:51:54 +01:00
Sascha Hauer 81fae63497 oftree: add fixup for memory nodes
Thanks to a common memory handling barebox knows the sdram banks
and sizes, so we can add a common fixup functions for the nodes
in the devicetree.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2011-10-19 10:09:50 +02:00
Sascha Hauer c0f9d1bad2 initial oftree command support
This adds basic device tree command support. So far we can
parse a flat device tree (-p), which also stores the tree
in memory, dump it (-d) and free (-f) the internally stored tree.

The chosen node can be updated with barebox bootargs, no other
device tree manipulation is implemented yet.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2011-10-19 10:09:48 +02:00
Jean-Christophe PLAGNIOL-VILLARD 05bd7afb3a digest: factorise file digest to common/digest.c
rename it to digest_file_window

introduce digest_file to digest a file and digest_file_by_name
where we specify the algo by name

Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2011-10-12 08:52:49 +02:00
Jean-Christophe PLAGNIOL-VILLARD 7b49dc335a image: move map_image amd unmap_image to image.c
Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2011-09-28 09:23:45 +02:00
Jean-Christophe PLAGNIOL-VILLARD bd7f9b52e2 image: use data base addr for image_print_contents, image_multi_count/getimg
as in barebox the data could be the mapped file or a allocated memory with
just the data (non header)

Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2011-09-28 09:23:45 +02:00
Sascha Hauer d01070c8af remove EARLY_INIT and EARLY_CONSOLE support
Bitrotted over time and nearly unused, so remove it.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2011-09-27 10:27:18 +02:00
Sascha Hauer fbd855d7f5 introduce generic memory bank handling
On arm we have the concept of memory banks which can
be registered and iterated over. This is useful for
other architectures aswell, so add some generic infrastructure
for this.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2011-09-23 16:32:49 +02:00
Sascha Hauer 0fc7fb6b4f rename include/mem_malloc.h to include/memory.h
Which is a better name and also better to collect other
things.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2011-09-23 16:32:48 +02:00
Jan Weitzel 22f7370d2b add option LOCALVERSION to common/Kconfig
Add Kconfig option LOCALVERSION so you can set a customizable suffix
to the barebox version string.

Signed-off-by: Jan Weitzel <j.weitzel@phytec.de>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2011-09-20 08:54:04 +02:00
Antony Pavlov 7d9ee32f05 commands/loads.c: make it compile again
Signed-off-by: Antony Pavlov <antonynpavlov@gmail.com>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2011-08-23 08:33:24 +02:00
Sascha Hauer 0cdde3782e put env_push_context into postcore_initcall
env_push_context only needs malloc, so initialize it earlier.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2011-08-17 09:37:48 +02:00
Sascha Hauer ad140020b8 console: make console device a child of the hardware device
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2011-08-15 09:48:03 +02:00
Jean-Christophe PLAGNIOL-VILLARD c78ef640cd login: add timeout support
If a timeout is specified and expired the command will be executed
by default boot

Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2011-08-11 09:22:07 +02:00
Sascha Hauer 43ebdba64a remove now unnecessary HAVE_MMU from Kconfig
MMU now can be enabled on every ARM board, so remove
the dependency.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2011-08-03 09:12:16 +02:00
Antony Pavlov 7e3f76437c Add option DEBUG_LL to common/Kconfig
Signed-off-by: Antony Pavlov <antonynpavlov@gmail.com>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2011-07-27 10:55:41 +02:00
Jean-Christophe PLAGNIOL-VILLARD 6ae6553e1a drivers: move resource generic management to driver/base/resource.c
Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
2011-07-21 13:47:16 +08:00
Sascha Hauer f928efa818 add a add_mem_device function
Add a helper function for boards to register their memory
devices. This makes the board code smaller and also helps
getting rid of map_base and struct memory_platform_data.

And switch all of the memory to it

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
2011-07-18 20:32:45 +08:00
Antony Pavlov 7530c82c3d startup.c: make DEBUG_LL output more useful
Signed-off-by: Antony Pavlov <antonynpavlov@gmail.com>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2011-07-18 23:04:18 +02:00
Sascha Hauer e6c03f01bf Merge branch 'next' 2011-07-06 10:25:04 +02:00
Jean-Christophe PLAGNIOL-VILLARD 85caaf5272 password: fix command support as module
add missing EXPORT_SYMBOL for nan static function

Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2011-07-05 09:34:14 +02:00
Jean-Christophe PLAGNIOL-VILLARD 78b77a332e menu: fix command support as module
add missing EXPORT_SYMBOL for nan static function

Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2011-07-05 09:34:13 +02:00
Carlo Caione 701edd4d98 shift and clocksource
Added clocks_calc_mult_shift()

Signed-off-by: Carlo Caione <carlo.caione@gmail.com>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2011-06-22 00:17:56 +02:00
Alexey Galakhov 943bf72dc8 fix console fifo (and loadb/loady commands)
This patch fixes loadb and loady commands. tstc() should return true if
console_input_buffer is not empty.

Signed-off-by: Alexey Galakhov <agalakhov@gmail.com>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2011-05-16 08:28:27 +02:00
Peter Korsgaard e7ed69d570 setenv: be robust against setenv(<var>, NULL)
Handle value == NULL similiar to how value == '' is currently handled.
hush's builtin_getopt() seems to trigger this for OPTARG.

Signed-off-by: Peter Korsgaard <jacmet@sunsite.dk>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2011-05-16 08:22:29 +02:00
Sascha Hauer 8e8c61e786 move simple_itoa to libbb so that others can use it
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2011-04-12 09:54:56 +02:00
Sascha Hauer 9640c2b4a5 environment: make default env path configurable
Normally the default path to save the environment is /dev/env0. However,
we can't map a file in a fat filesystem to /dev/env0. So if we want to
store the environment in a file in fat we have to make it configurable.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2011-04-12 09:54:56 +02:00
Sascha Hauer 523daf675a add dummy_malloc functions
For some environments the dummy malloc functions offer a very small
alternative implementation. malloc will get its memory from sbrk()
and never frees memory again.
This of course is not suitable for interactive environments and thus
depends on CONFIG_SHELL_NONE

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2011-04-11 15:57:51 +02:00
Sascha Hauer 2a37624950 malloc: put common memory functions to seperate file
These functions are needed independently of the specific
malloc implementation, so move them out.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2011-04-11 15:57:51 +02:00
Sascha Hauer 5b85da326a add noshell support
Some scenarios like initial bootloaders do not need interactive shell
support, so make this optional. Without a shell a board must provide
its own run_shell function.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2011-04-11 15:57:51 +02:00
Sascha Hauer 3c702a58c7 make command support optional
In a noninveractive environment we do not need commands. So make
them optional.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2011-04-11 15:57:51 +02:00
Sascha Hauer 71a4899e18 env: Make environment variable support optional
Environment variables are only useful in interactive environments.
Make it optional on our way to support a noninteractive barebox.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2011-04-11 15:57:51 +02:00
Sascha Hauer 61f41e3c54 add block support
This adds a simple block layer to barebox. Reading and writing
to block devices can be painfully slow without caching, so
add a simple caching layer here.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2011-04-11 15:57:51 +02:00
Sascha Hauer 3f1ff6b730 move version_string to seperate file
In a noninteractive environment barebox will be compiled without
command support. So move version_string to a seperate file which
is compiled unconditionally.
Also, display the banner when the simple console support is used.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2011-04-11 12:36:08 +02:00
Sascha Hauer 4b935522de startup: we can only mount root and devfs when compiled in
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2011-04-11 12:36:08 +02:00
Sascha Hauer 691dd27f7a Merge branch 'next' 2011-04-04 14:53:08 +02:00
Jon Ringle e9831a6817 defaultenv: fix empty CONFIG_DEFAULT_ENVIRONMENT_PATH
if CONFIG_DEFAULT_ENVIRONMENT_PATH="" then
$(DEFAULT_ENVIRONMENT_PATH) expands to 'defaultenv "" '
The "" would cause every single file found in $(srctree) to be included in
$(ENV_FILES). This would then cause scripts/mod/sumversions.c to get
recompiled using $(CC) and fail compilation if $(CC) points to a newlib
cross compiler

Signed-off-by: Jon Ringle <jon@ringle.org>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2011-03-23 09:46:29 +01:00
Sascha Hauer 3e48ef43ed Merge branch 'master' into next 2011-03-10 14:50:25 +01:00
Sascha Hauer f4491d7b04 kallsyms/printk: enable symbol printing support (%pS)
With this kallsyms finally start working at least on ARM. This
enables us resolving addresses into symbols which is particularly
useful in combination with stack unwinding support. As kallsyms
now compile and work we can remove the depends on BROKEN.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2011-03-10 14:50:16 +01:00
Sascha Hauer 0ed964589c module: CONFIG_COMMAND does not exist anymore, remove ifdefs
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2011-03-10 14:48:49 +01:00
Sascha Hauer 06ea6c135d Merge branch 'next' 2011-02-03 10:49:18 +01:00
Juergen Beisert 76dd3e70a5 Fix default baudrate setting
The menu entry to set the default baudrate (CONFIG_BAUDRATE) makes no sense,
as long as its content is not used. This patch makes barebox using the setting
again.

Signed-off-by: Juergen Beisert <jbe@pengutronix.de>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2011-01-18 14:24:09 +01:00
Sascha Hauer 3e892255b3 startup: make debug printing of linker variables work again
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2011-01-17 11:05:14 +01:00
Sascha Hauer 2f0109b1bb Merge branch 'master' into next 2011-01-17 09:43:40 +01:00
Marc Reilly 0764c345f7 Init env context a bit earlier in initalization sequence.
Ensures subsequent init functions to export environment variables during
init without having to rely on linking order being correct.

Signed-off-by: Marc Reilly <marc@cpdesign.com.au>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2011-01-10 20:04:34 +01:00
Sascha Hauer 63100f4e15 device tree: fix printf compiler warnings
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2011-01-07 11:36:50 +01:00
Krzysztof Halasa 1b6a3e3634 Silence few warnings.
Signed-off-by: Krzysztof Hałasa <khc@pm.waw.pl>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2010-12-21 09:02:40 +01:00
Sascha Hauer 50352ae9d9 Merge branch 'led' into next 2010-12-21 08:25:31 +01:00
Marc Kleine-Budde 0277a663bc Add generic poll infrastructure
Barebox does not have interrupt functionality. Nevertheless it's
sometimes useful to periodically call functions, like for example
a heartbeat LED or watchdog reset. Instead of cluttering the code
with calls to these functions this patch adds a generic polling
infrastructure. Code which might run for longer now can call
poller_call() periodically which in turn will call all registered
pollers.
This patch adds a call to poller_call in two generic pathes. First
of them is getc() which covers waiting for uart input. Second is
ctrlc() which should be called anyway from code which might run
for longer. So instead adding poller_call directly to your code,
consider checking ctrlc instead which also gives additional
convenience to the user.
The poller code is safe against reentrancy which means that it's
safe to call poller_call inside a poller.

Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2010-12-20 09:28:21 +01:00
Peter Korsgaard 1945936991 console_simple: add fprintf / console_list for commands/loadb.c
commands/loadb.c doesn't build with CONFIG_CONSOLE_SIMPLE, because it uses
fprintf / for_each_console (which uses console_list).

Fix it by adding trivial implementations of both in console_simple.

Signed-off-by: Peter Korsgaard <jacmet@sunsite.dk>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2010-12-12 09:27:40 +01:00
Robert Schwebel c84a37d52b parser: use debug macros
Signed-off-by: Robert Schwebel <r.schwebel@pengutronix.de>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2010-11-01 11:44:48 +01:00
Robert Schwebel bd8db893bb doc: silence doxygen warnings
Silence these warnings:

common/kallsyms.c:8: Warning: documented function `const u8 kallsyms_names' was not declared or defined.
common/kallsyms.c:10: Warning: documented function `const u8 kallsyms_token_table' was not declared or defined.
common/kallsyms.c:11: Warning: documented function `const u16 kallsyms_token_index' was not declared or defined.
common/kallsyms.c:13: Warning: documented function `const unsigned long kallsyms_markers' was not declared or defined.

Signed-off-by: Robert Schwebel <r.schwebel@pengutronix.de>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2010-10-22 20:47:03 +02:00
Sascha Hauer d32a9273cf common/memsize.c: add missing include
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2010-10-21 22:21:25 +02:00
Sascha Hauer 361bb24081 common/environment.c: sparse fixes
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2010-10-21 22:21:25 +02:00
Sascha Hauer e2fadcc34a version_string: sparse fixes
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2010-10-21 22:21:24 +02:00
Sascha Hauer 6de93941c2 common/env.c: sparse fixes
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2010-10-21 22:21:24 +02:00
Sascha Hauer 345d93eb7c hush: sparse fixes
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2010-10-21 22:21:24 +02:00
Sascha Hauer f538b46572 console: sparse fixes
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2010-10-21 22:21:23 +02:00
Sascha Hauer 5a049d8b5d dlmalloc: sparse fixes
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2010-10-21 22:21:23 +02:00
Sascha Hauer a64c756ad9 image: remove confusing image_check_* functions
The function names do not make it clear what return value
is expected and do not save a single line of code. Put
the code inline and unbreak the wrong checks introduced
with a3c1e5d888.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Acked-by: Eric Bénard <eric@eukrea.com>
Acked-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
2010-10-13 17:39:49 +02:00
Jean-Christophe PLAGNIOL-VILLARD 3b8942faa0 defaultenv/update: add check crc32 options
Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2010-10-12 21:32:45 +02:00
Jean-Christophe PLAGNIOL-VILLARD 5c3538f44d defaultenv/update: merge update_rootfs and update_kernel
use getopt to simplify it and prepare for xmodem support

Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2010-10-12 21:32:44 +02:00
Jean-Christophe PLAGNIOL-VILLARD 4dfd5b5c62 defaultenv: introduce CONFIG_DEFAULT_ENVIRONMENT_GENERIC to enable it
this will we usefull to enable functionnality if used

Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2010-10-12 21:32:44 +02:00
Sascha Hauer 914e2f8f7f hush: implement getopt builtin
Positional parameters are not nice, so implement a getopt
function. This has to be done as a builtin because otherwise
we have no access to the parents argc/argv.

getopt works as expected, here is a little example:

while getopt "hs:" OPT
do
        if [ $OPT = h ]; then
                echo "usage"
                exit 1
        else
                echo "scr: opt: $OPT optarg: $OPTARG"
	fi
done

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2010-10-08 15:30:43 +02:00
Sascha Hauer 97b2a33c50 hush: fix nasty memory leak in hush
Fix memory leak in globbing part of hush. a simple '['
on the command line was enough to trigger it.
We must call globfree() before setting the glob structure
to zero.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2010-10-08 14:18:37 +02:00
Sascha Hauer dff63d2399 hush: pass context around in shell
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2010-10-08 11:40:09 +02:00
Jean-Christophe PLAGNIOL-VILLARD 24b499f3fe image: factorise image printing contents
Copied from U-Boot

Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
2010-10-08 00:06:23 +08:00
Jean-Christophe PLAGNIOL-VILLARD a3c1e5d888 Replace direct header access with the API routines
Copied from U-Boot

Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
2010-10-08 00:04:28 +08:00
Jean-Christophe PLAGNIOL-VILLARD 2fbdb02b11 image: rename IH_CPU to IH_ARCH to be more concistant
Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
2010-10-08 00:03:56 +08:00
Jean-Christophe PLAGNIOL-VILLARD ad4da3a4a1 image: factorise string helper
Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
2010-10-08 00:03:22 +08:00
Sascha Hauer 6d2812b93d Revert "image: factorise string helper"
This reverts commit 7bd7d59e60.
2010-10-07 14:13:21 +02:00
Sascha Hauer 6c4b1b6da0 Revert "image: rename IH_CPU to IH_ARCH to be more concistant"
This reverts commit aba80a2d2d.

Conflicts:

	include/image.h

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2010-10-07 14:13:10 +02:00
Sascha Hauer f7403928a9 Revert "Replace direct header access with the API routines"
This reverts commit 0ceafe14be.

Conflicts:

	include/image.h

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2010-10-07 14:11:38 +02:00
Sascha Hauer 884f4d47c6 Revert "image: factorise image printing contents"
This reverts commit d424ce77f5.
2010-10-07 14:09:21 +02:00
Jean-Christophe PLAGNIOL-VILLARD 098e9e8f20 console: set device_d id at -1
Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2010-09-24 08:46:41 +02:00
Jean-Christophe PLAGNIOL-VILLARD d424ce77f5 image: factorise image printing contents
before we duplicate it between command/bootm.c and scripts/mkimage.c

Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2010-09-24 08:46:40 +02:00
Jean-Christophe PLAGNIOL-VILLARD 0ceafe14be Replace direct header access with the API routines
Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2010-09-24 08:46:22 +02:00
Jean-Christophe PLAGNIOL-VILLARD aba80a2d2d image: rename IH_CPU to IH_ARCH to be more concistant
Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2010-09-23 09:55:50 +02:00
Jean-Christophe PLAGNIOL-VILLARD 7bd7d59e60 image: factorise string helper
before we duplicate it between common/bootm.c and scripts/mkimage.c

Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2010-09-23 09:55:50 +02:00
Sascha Hauer 2db4aa5c32 rename __initdata to __early_initdata
The __initdata define was present before Jean-Christophe
added it as fake value for Linux compatibility. Rename
the previous define to a different name to avoid
clashes

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2010-09-20 09:21:31 +02:00
Jean-Christophe PLAGNIOL-VILLARD a47575911d Menu: add box style entry
this will allow you to create a box style entry

via C API by specifying the type as

struct menu_entry me = {
	.display "test",
	.type = MENU_ENTRY_BOX,
	.box_state = 1,
	.action = action_to_run,
}

and via shell
menu -e -a -m <menu> -c <command> [-R] [-b 0|1] -d <description>
menu -e -a -m <menu> -u submenu -d [-b 0|1] <description>

-b with 0 for not selected and 1 for selected
and -c for the command to run when changing state

Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2010-09-20 08:58:53 +02:00
Jean-Christophe PLAGNIOL-VILLARD 7923392c56 menu: add auto select support
this will allow to automaticaly run an entry if the user do no choice

this is usefull for boot menu as example

with menu -s -m boot -A 3 -d "Auto Boot in"

Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2010-09-20 08:58:52 +02:00
Jean-Christophe PLAGNIOL-VILLARD e85c6bb0a7 driver: use id as -1 for auto assigned id
before if you specify id = 0 the next available id will be taken
otherwise fail if already registered now as in linux we use -1

Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2010-09-20 08:58:52 +02:00
Jean-Christophe PLAGNIOL-VILLARD c83ebb95f1 add password framework
Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
2010-09-20 08:57:22 +02:00
Jean-Christophe PLAGNIOL-VILLARD 77a57f4cb4 add digest framework
Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
2010-09-20 08:57:21 +02:00
Jean-Christophe PLAGNIOL-VILLARD 935cdf5a1e move barebox_default_env.h to include/generated/
Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
2010-09-17 10:56:24 +08:00
Jean-Christophe PLAGNIOL-VILLARD 93bd1526aa move utsrelease.h to include/generated/ instead of include/linux
Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
2010-09-17 10:56:24 +08:00
Sascha Hauer 0d35c3c8a0 menu: simplify usage for clients
Clients now only have to call menu_add_submenu or menu_add_command_entry
instead of allocating many strings.
This also fixes some problems in the menu code. The priv field in struct
menu_entry was a pointer to struct menu or a pointer to an allocated string.
It was never freed, only had to be freed when it was an allocated string.
The reference to a submenu is now kept as a string and not to the menu
itself. The code checked the existence of the submenu when creating it, but
crashed when the submenu was removed and referenced afterwards. Now the
code hapily allows references to nonexistant menus but complains during
runtime when the menu is not there.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2010-08-30 21:06:02 +02:00
Sascha Hauer f50d2063cb menu: use an initialized struct list as menu list
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2010-08-30 20:57:20 +02:00
Sascha Hauer 417e2d45fe menu: use list_for_each_entry where appropriate
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2010-08-30 20:57:20 +02:00
Sascha Hauer b11b88de64 menu: remove superfluous struct menu_entry member from struct menu
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2010-08-30 20:57:20 +02:00
Sascha Hauer a75d6dacc3 menu: simplify menu_free with list_for_each_entry_safe
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2010-08-30 20:57:20 +02:00
Sascha Hauer 86086c5faa menu: initialize entries list in menu_alloc
Otherwise menu_free fails when menu_add failed.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2010-08-30 20:57:20 +02:00
Jean-Christophe PLAGNIOL-VILLARD 6ce1c664de Menu/cmd: add sub menu entry command support
this will simplify the creation of navigation link

as this

menu -a -m boot -d "Boot Menu"
menu -a -m network -d "Network settings"
menu -e -a -m network -u boot -d "Back"
menu -e -a -m boot -u network -d "Network settings ->"
menu -e -a -m boot -c reset -R -d "Reset"
menu -e -a -m boot -c clear -d "Exit"
menu -s -m boot

in C

struct menu m_boot = {
	.name = "boot",
	.display = "Boot Menu",
};

struct menu m_network = {
	.name = "network",
	.display = "Network settings",
};

struct menu_entry e_to_network = {
	.display = "Network settings ->",
	.action = menu_action_show,
	.priv = &m_network,
};

struct menu_entry e_to_boot = {
	.display = "Back",
	.action = menu_action_show,
	.priv = &m_boot,
};

struct menu_entry e_reset = {
	.display = "Reset",
	.action = menu_action_run,
	.priv = "reset",
};

struct menu_entry e_exit = {
	.display = "Exit",
	.action = menu_action_run,
	.non_re_ent = 1,
	.priv = "clear",
};

void menu_test(void)
{
	menu_add(&m_boot);
	menu_add(&m_network);
	menu_add_entry(&m_boot, &e_to_network);
	menu_add_entry(&m_boot, &e_reset);
	menu_add_entry(&m_boot, &e_exit);
	menu_add_entry(&m_network, &e_to_boot);
	menu_show(&m_boot);
}

Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2010-08-30 20:57:20 +02:00
Jean-Christophe PLAGNIOL-VILLARD b712b26632 Add Menu Framework
Introduce a menu framework that allow us to create list menu to simplify
barebox and make it more user-frendly

This kind of menu is very usefull when you do not have a keyboard or a
serial console attached to your board to allow you to interract with
barebox

For the develloper part,
The framework introduce two API

1) C
that allow you to create menu, submenu, entry and complex menu action

2) Command
that allow you as the C API to create menu, submenu, entry and complex
menu action but this time the actions will be store in a function and
then be evaluated and excecuted at runtime.

Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2010-08-30 20:57:20 +02:00
Jean-Christophe PLAGNIOL-VILLARD 7167eb8c0b Kconfig: sync with linux kernel v2.6.36-rc1-168-ge36c886
this will add also the support of the new ncurse interface nconfig

Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
2010-08-22 13:12:27 +08:00
Jean-Christophe PLAGNIOL-VILLARD d879de38e8 barebox_default_env: fix out of tree build
Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2010-07-22 15:49:02 +02:00
Sascha Hauer 600c0e987e Allow to merge default environment from more than one directory
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2010-06-22 15:44:40 +02:00
Sascha Hauer 56d0e7f274 errno: add strings for network related error messages
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2010-06-17 08:28:29 +02:00
Sascha Hauer c3789cd49b rework device parameters
Change device parameters so that the memory management is in generic
code. This also removes the need of storing statically initialized
parameters as they are stored in a struct list_head for each device.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2010-06-17 08:28:25 +02:00
Luotao Fu f498576cb6 fix error return value while loading environment
Signed-off-by: Luotao Fu <l.fu@pengutronix.de>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2010-05-03 15:01:28 +02:00
Uwe Kleine-König 3a1617d96f clock: fix possible error on overflow in is_timeout
Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
Signed-off-by: Wolfram Sang <w.sang@pengutronix.de>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2010-04-22 13:29:22 +02:00
Sascha Hauer edf4e51a82 introduce a arch_shutdown call and call it from shutdown_barebox
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2010-03-30 14:15:03 +02:00
Sascha Hauer e723f79cb7 make panic and hang __noreturn functions
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2010-03-30 14:15:03 +02:00
Sascha Hauer 6eb741a2e1 hush: allow fancy prompts
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2010-03-30 14:15:03 +02:00
Sascha Hauer 66e4e9242b hush: only remove backslashes introduced from glob
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2010-03-30 14:15:03 +02:00
Sascha Hauer 2477fb12e9 hush: Fix return code when calling 'exit' inside loops
v2: Do not exit from all scripts but only the current one

This fixes the case:

barebox:/ cat /test
if [ 0 = 0 ]; then
	exit 1
fi
barebox:/ /test
barebox:/ echo $?
0
barebox:/

Also, remove code to not allow exit from main shell. The for(;;) loop
in common/startup.c will bring us back anyway.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2010-03-30 12:51:44 +02:00
Sascha Hauer 922bb41a47 remove typedef cmd_tbl_t and replace it with struct command
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2010-02-01 17:25:32 +01:00
Sascha Hauer 085e30b4b0 remove unused file common/flash.c
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2010-02-01 17:25:31 +01:00
Robert P. J. Day 06c5d3d9fa Remove/adjust erroneous references to CONFIG_MODULE.
The correct config variable is CONFIG_MODULES, so tweak any references
to the incorrect CONFIG_MODULE.

Signed-off-by: Robert P. J. Day <rpjday@crashcourse.ca>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2009-12-21 14:21:45 +01:00
Sascha Hauer a3ffa97f40 rename U-Boot-v2 project to barebox
This has been done with the following script:

find -path ./.git -prune -o -type f -print0 | xargs -0 -r sed -i \
	-e 's/u2boot/barebox/g' \
	-e 's/U2Boot/barebox/g' \
	-e 's/U-boot V2/barebox/g' \
	-e 's/u-boot v2/barebox/g' \
	-e 's/U-Boot V2/barebox/g' \
	-e 's/U-Boot-v2/barebox/g' \
	-e 's/U_BOOT/BAREBOX/g' \
	-e 's/UBOOT/BAREBOX/g' \
	-e 's/uboot/barebox/g' \
	-e 's/u-boot/barebox/g' \
	-e 's/u_boot/barebox/g' \
	-e 's/U-Boot/barebox/g' \
	-e 's/U-boot/barebox/g' \
	-e 's/U-BOOT/barebox/g'

find -path ./.git -prune -o \( -name "*u-boot*" -o -name "*uboot*" -o -name "*u_boot*" \) -print0 | \
	xargs -0 -r rename 's/u[-_]?boot/barebox/'

It needs some manual fixup following in the next patch

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2009-12-15 10:18:30 +01:00
Juergen Beisert 8c187839ee Re-format the file
Re-format the file with 'indent' and some manual corrections.

Signed-off-by: Juergen Beisert <jbe@pengutronix.de>
2009-12-10 13:09:02 +01:00
Juergen Beisert 5ed894e9a6 Combine memory initialization with the main memory functions.
Memory allocation is very simple in u-boot-v2. So, it makes also sense to
add the "operating system" emulation layer into the main memory management
source file, to keep them at one place and simple.

Signed-off-by: Juergen Beisert <jbe@pengutronix.de>
2009-12-10 13:09:02 +01:00
Juergen Beisert e0a2f39561 Use the global string functions
Don't try to be smarter than GCC. There are various better optimizations
available than to write our own. So, use the globaly available string
functions instead.

Signed-off-by: Juergen Beisert <jbe@pengutronix.de>
2009-12-10 13:09:02 +01:00
Juergen Beisert a9dda0de1e Remove win32 support
Remove never used code.

Signed-off-by: Juergen Beisert <jbe@pengutronix.de>
2009-12-10 13:09:02 +01:00
Juergen Beisert e70f5a92a9 Remove debug code
When assert() is always defined to do nothing, the debug functions makes no
sense, because they also do nothing. Removing them shrinks the code.

Signed-off-by: Juergen Beisert <jbe@pengutronix.de>
2009-12-10 13:09:02 +01:00
Juergen Beisert 86e3217dde Use nowadays function prototypes
Use a function prototype style as used in all other u-boot-v2 sources, too.
Also remove C++ support. We do not use C++ in this project.

Signed-off-by: Juergen Beisert <jbe@pengutronix.de>
2009-12-10 13:09:02 +01:00
Juergen Beisert 7fd641558b After moving all declarations to the C source, do the same with the doc
Done in preparation to provide this documentation for doxygen.

Signed-off-by: Juergen Beisert <jbe@pengutronix.de>
2009-12-10 13:09:02 +01:00
Juergen Beisert e954ee0647 Remove confusing macros that hide the real functions names
This feature is provided, to support more than u-boot-v2. But its more
confusing than helpful. Remove it and do it straight forward like all other
sources in this tree, too.

Signed-off-by: Juergen Beisert <jbe@pengutronix.de>
2009-12-10 13:09:02 +01:00