9
0
Fork 0
Commit Graph

1508 Commits

Author SHA1 Message Date
Alexander Aring 3275c7ea43 common: add memtest.c with mem_test routine
Add mem_test routine. Useful to detect timing problems if someone
porting a new device to barebox. This test includes a data bus test,
address bus test and integrity check of memory.

This mem_test routine has as parameter start and end address of testing
space. The last parameter can skip the integrity check.

Signed-off-by: Alexander Aring <alex.aring@gmail.com>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2013-06-05 22:54:35 +02:00
Sascha Hauer 5f56c35060 Merge branch 'for-next/of' 2013-06-02 16:28:34 +02:00
Sascha Hauer 5e7f855847 Merge branch 'for-next/block' 2013-06-02 12:35:47 +02:00
Sascha Hauer b27af5cdf3 partition: DOS: Add parameter for the NT disk Signature
The NT disk Signature is a unique 32-bit value in the MBR allowing
to identify a MSDOS partitioned disk. The signature can be used to
specify the Linux rootfs.
This patch adds support for the NT disk Signature in the form of a
device parameter which can both be read and written.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2013-06-02 12:35:13 +02:00
Sascha Hauer 5014bf0cc5 partitions: Add missing depends on BLOCK
The disk partitions use blockdevice functions, so add the corresponding
depends on BLOCK.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2013-06-02 12:35:13 +02:00
Sascha Hauer df1dcc057e Merge branch 'for-next/misc' 2013-06-02 12:24:56 +02:00
Sascha Hauer e82e40523f block: implement block_read/block_write functions
Some drivers use blk->ops->read/write. This bypasses the caching block
layer and was never intended like this. The upper API to the block layer
is the cdev layer. This patch adds block_read and block_write functions
and uses them where appropriate.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2013-05-31 09:34:48 +02:00
Sascha Hauer b5c4e238d3 block: rename file operation functions
block_read and block_write collide with a to-be-introduced
global function, so rename the file operation functions.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2013-05-31 09:23:52 +02:00
Sascha Hauer b5167ee51c bootm: print Kernel commandline in verbose mode
Without devicetree support we print the Kernel commandline in
verbose mode. Do the same with devicetree boot aswell.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2013-05-31 08:32:37 +02:00
Sascha Hauer a872dc166a of: remove unused define
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2013-05-31 08:32:27 +02:00
Sascha Hauer 95453258d6 make: Add barebox_default_env.* to targets
Otherwise it gets rebuilt everytime.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2013-05-25 15:11:50 +02:00
Sascha Hauer fe85ff4761 treewide: Fix typo seperate -> separate
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2013-05-21 21:38:21 +02:00
Sascha Hauer c19efab886 Merge branch 'for-next/param'
Conflicts:
	drivers/mci/mci-core.c
2013-05-06 09:30:50 +02:00
Sascha Hauer 3cdd18632e Merge branch 'for-next/memory-commands' 2013-05-06 09:30:28 +02:00
Hubert Feurstein a5e4764679 common/partition: check only for partition table types
The detection of the partition table fails when we have a barebox image
in the MBR. So check only for partition table types.

Signed-off-by: Hubert Feurstein <h.feurstein@gmail.com>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2013-04-29 09:34:13 +02:00
Hubert Feurstein c06956e15f common/filetype: move partition-table detection into own function
Signed-off-by: Hubert Feurstein <h.feurstein@gmail.com>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2013-04-29 09:32:54 +02:00
Sascha Hauer 255e5b4c42 memory commands: move memory_display to separate file
memory_display is a function which should generally be available.
Currently it depends on memory command support being compiled in,
so move the function to a separate file.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2013-04-17 13:35:17 +02:00
Sascha Hauer ab855df99f console: Use dev_add_param_int for baudrate parameter
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2013-04-11 11:48:35 +02:00
Sascha Hauer dd9f6d08a2 Merge branch 'for-next/relocate'
Conflicts:
	arch/arm/lib/barebox.lds.S
2013-04-04 14:20:42 +02:00
Sascha Hauer 2143dfda8b Merge branch 'for-next/pr_print' 2013-04-04 14:20:33 +02:00
Sascha Hauer c4da77611c Merge branch 'for-next/oftree' 2013-04-04 14:20:32 +02:00
Sascha Hauer 45b87922a6 Merge branch 'for-next/misc-arm' 2013-04-04 14:20:32 +02:00
Sascha Hauer 8f2c6a3d2b Merge branch 'for-next/misc' 2013-04-04 14:20:32 +02:00
Marc Kleine-Budde d366ae8382 bootsource: add definition for i2c-eeprom, spi-nor, spi-eeprom and usb
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2013-04-04 10:54:27 +02:00
Marc Kleine-Budde 5d8240619c bootsource: add support for bootsource instance information
Add a C interface to set and get the bootsource instance:

    int bootsource_get_instance(void);
    void bootsource_set_instance(int instance);

Also export the shell variable "bootsource_instance".

Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2013-04-04 10:54:27 +02:00
Marc Kleine-Budde 54c3870f54 bootsource: use initcall to export bootsource location to environment
This way the bootsource is exported to the environment, even if unknown.

Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2013-04-04 10:54:27 +02:00
Marc Kleine-Budde 7b66d9cddd bootsource: create arch independent bootsource framework
This patch seperates the imx independent from the arch independent code. The
following functions and enums are renamed:

- imx_bootsource() -> bootsource_get()
- imx_set_bootsource() -> bootsource_set()
- enum imx_bootsource -> enum bootsource

Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2013-04-04 10:54:22 +02:00
Sascha Hauer 9eefa7445e include asm/sections.h instead of asm-generic/sections.h
To let the architectures override asm-generic/sections.h

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2013-03-10 11:05:46 +01:00
Jean-Christophe PLAGNIOL-VILLARD 1d60b224e5 barebox_banner: switch to pr_info
Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2013-03-09 11:18:08 +01:00
Jean-Christophe PLAGNIOL-VILLARD 42459443b6 startup: switch to pr_xxx
Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2013-03-09 11:18:08 +01:00
Jean-Christophe PLAGNIOL-VILLARD a4a8b454e1 meminfo: switch to pr_xxx
Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2013-03-09 11:16:17 +01:00
Jean-Christophe PLAGNIOL-VILLARD 50c9df4899 startup: switch to pr_xxx
Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2013-03-09 11:16:17 +01:00
Sascha Hauer d34aca4c09 dummy malloc: Add licence header
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2013-03-08 08:47:51 +01:00
Sascha Hauer a81ec0225f ARM: Add relocatable binary support
For making the same binary executable on different SoCs which have
different DRAM addresses we have to be independent of the compile
time link address.

This patch adds relocatable binary support for the ARM architecture.
With this two new functions are available. relocate_to_current_adr
will fixup the binary to continue executing from the current position.
relocate_to_adr will copy the binary to a given address, fixup the
binary and continue executing from there.

For the PBL and the real image relocatable support can be enabled
independently. This is done to (hopefully) better cope with setups
where the PBL runs from SRAM or ROM and the real binary does not.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2013-03-07 12:38:01 +01:00
Jean-Christophe PLAGNIOL-VILLARD 6640f5e399 tlsf_malloc: drop duplicate include
config.h is not need and already inclued by Makefile

Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2013-03-07 08:37:22 +01:00
Sascha Hauer a51d06d679 of: remove unused libfdt
Now that we are completely independent of libfdt remove the unused
code.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2013-03-06 11:41:29 +01:00
Sascha Hauer 973e58e3ab ARM bootm: Switch initrd support to unflattened tree
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2013-03-06 11:41:29 +01:00
Sascha Hauer 3d554f9925 of: memory: Use of_write_number
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2013-03-06 11:41:29 +01:00
Sascha Hauer 9d8e08353c of: fixup unflattened devicetree
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2013-03-06 11:41:29 +01:00
Sascha Hauer 64c199dd29 of: Pass barebox internal format devicetree to of_get_fixed_tree
With this every devicetree is first converted to the barebox internal
format before it's converted back to dtb again.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2013-03-06 11:41:28 +01:00
Sascha Hauer 004cce1347 of: make flatten independent of libfdt
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2013-03-06 11:41:28 +01:00
Jean-Christophe PLAGNIOL-VILLARD 8be08d9cf2 defaultenv-2: add boot sequence
This allows to boot a sequence of boot entries until one succeeds.

boot sources can be passed in $global.boot.default, which is now treated
as a list. Also a list of boot entries can be specified as arguments
to the boot script. The entries can be:

- a plain filename from /env/boot/
- a full path to an arbitrary file
- a directory containing boot entries

With this this command:

boot net nand-ubi /env/boot.d

would first use the /env/boot/net entry, if this fails the /env/boot/nand-ubi
entry and if this also fails the files from /env/boot.d/ (which could also
be links to boot scripts)

To make the above the default, global.boot.default would be specified as:

global.boot.default="net nand-ubi /env/boot.d"

Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2013-03-05 11:51:35 +01:00
Sascha Hauer ea0f831cd0 Merge branch 'for-next/mxs' 2013-03-04 09:21:54 +01:00
Sascha Hauer 13408877f4 Merge branch 'for-next/misc' 2013-03-04 09:21:37 +01:00
Sascha Hauer 831d83e922 Merge branch 'for-next/highbank' 2013-03-04 09:21:37 +01:00
Sascha Hauer c6813a5fb1 Merge branch 'for-next/gpt' 2013-03-04 09:21:37 +01:00
Sascha Hauer 1eb77960b8 Merge branch 'for-next/dt' 2013-03-04 09:21:37 +01:00
Sascha Hauer 3d9c751312 Merge branch 'for-next/console' 2013-03-04 09:21:36 +01:00
Jean-Christophe PLAGNIOL-VILLARD 6ae2455e80 of: add do_fixup_by_compatible with u32 and string version
Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2013-03-03 14:08:44 +01:00
Fabio Porcedda 8e418dcc63 menu: fix remove superfluous newline: change puts() -> printf("%s", )
Fix previous commit:
638f91b "fix compiler warnings: use puts() instead of printf()".

Because puts() function add a newline, use instead printf("%s", ).

Signed-off-by: Fabio Porcedda <fabio.porcedda@gmail.com>
Cc: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
Cc: Vicente Bergas <vicencb@gmail.com>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2013-02-26 15:04:23 +01:00
Sascha Hauer 6ad2bdb8e1 hush: implement $*
To get all arguments a script is called with.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2013-02-26 11:05:02 +01:00
Eric Bénard eec960e3b3 env: add register_persistent_environment
- heavily copied from register_persistant_environment which was
Signed-off-by: Juergen Beisert <jbe@pengutronix.de>

Signed-off-by: Eric Bénard <eric@eukrea.com>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2013-02-21 14:45:43 +01:00
Fabio Porcedda 638f91bd16 fix compiler warnings: use puts() instead of printf()
Use puts() because printf() isn't necessary,
to fix the following compiler warnings:

/barebox/common/menu.c: In function ‘menu_show’:
/barebox/common/menu.c:277:4: warning: format not a string literal and no format arguments [-Wformat-security]

/barebox/scripts/omap4_usbboot.c: In function ‘read_asic_id’:
/barebox/scripts/omap4_usbboot.c:101:3: warning: format not a string literal and no format arguments [-Wformat-security]

Signed-off-by: Fabio Porcedda <fabio.porcedda@gmail.com>
Cc: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
Cc: Vicente <vicencb@gmail.com>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2013-02-21 14:25:57 +01:00
Jean-Christophe PLAGNIOL-VILLARD 760689e5cc disk: partitions: add EFI GUID Partition Table
form linux 3.8

so you can have part by num or name
not by GUID as this is a non human reading name

     `---- ffe08000.sata
          `---- 0x00000000-0x3fffffff: /dev/ata0
          `---- 0x00100000-0x063fffff: /dev/ata0.0
          `---- 0x00100000-0x063fffff: /dev/ata0.boot
          `---- 0x06400000-0x3fefffff: /dev/ata0.1
          `---- 0x06400000-0x3fefffff: /dev/ata0.linux

Cc: Rob Herring <rob.herring@calxeda.com>
Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2013-02-18 09:11:37 +01:00
Jean-Christophe PLAGNIOL-VILLARD 86b3577a72 disk: introduce partition name
so we can register partion with name as present in EFI GPT

Cc: Rob Herring <rob.herring@calxeda.com>
Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2013-02-16 23:39:08 +01:00
Jean-Christophe PLAGNIOL-VILLARD 263bb23ed2 partitons: add framework
so we can support multiple format

use filetpye to detect the parser to use

Cc: Rob Herring <rob.herring@calxeda.com>
Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2013-02-16 23:39:08 +01:00
Jean-Christophe PLAGNIOL-VILLARD a7d9ec0498 filetype: add GPT support
GPT need to be check before MBR

Cc: Rob Herring <rob.herring@calxeda.com>
Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2013-02-16 23:39:08 +01:00
Sascha Hauer a40e76cebc Add warning above get_ram_size
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2013-02-13 18:14:38 +01:00
Sascha Hauer c429c68416 console: consolidate common console code
The different console implementations share a good amount of code,
share this in console_common.c.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2013-02-13 09:22:33 +01:00
Vicente Bergas afab6ac783 DeviceTree: add support for initrd in the DT
Add the initrd start and end address to the DT, code comes from u-boot.

Signed-off-by: Vicente Bergas <vicencb@gmail.com>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2013-02-12 09:04:27 +01:00
Alexander Aring c7a9534359 hush: add getopt only if it enabled
This patch add getopt to the command list if it enabled via
Kconfig. With this patch we get a 'command not found' error.
Otherwise getopt doing nothing.

Signed-off-by: Alexander Aring <alex.aring@gmail.com>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2013-02-11 20:57:33 +01:00
Sascha Hauer b7bcba8b65 ARM: Enable mmu early
This optionally enabled the MMU in the PBL or during early startup for
the non PBL case. The regular MMU init code will pickup the already enabled
MMU later. This might complicate debugging early code, so this has been
made optional.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2013-02-04 15:52:41 +01:00
Sascha Hauer 8e19ee94ab ARM: Setup stack at end of SDRAM
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2013-02-04 15:52:41 +01:00
Sascha Hauer 91493b1b5d ARM: remove now unused MACH_[HAS|DO]_LOWLEVEL_INIT
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
2013-02-04 15:52:40 +01:00
Sascha Hauer 56325edd79 Merge branch 'for-next/pbl' 2013-02-04 15:49:07 +01:00
Sascha Hauer 0b12784089 Merge branch 'for-next/oftree'
Conflicts:
	drivers/of/base.c
2013-02-04 15:49:04 +01:00
Sascha Hauer da5fe0ba47 Merge branch 'for-next/misc' 2013-02-04 15:49:00 +01:00
Sascha Hauer 22e2544809 Merge branch 'for-next/compile-log-level'
Conflicts:
	drivers/usb/host/ehci-hcd.c
2013-02-04 15:48:51 +01:00
Jean-Christophe PLAGNIOL-VILLARD 2d553ae51b menu: the dependancy on process escape is wrong drop it
Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2013-01-31 19:16:33 +01:00
Jean-Christophe PLAGNIOL-VILLARD 36db2a0f05 pbl: move configs to pbl/Kconfig
so it more easy to add new entry and to maintain

Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2013-01-30 22:27:19 +01:00
Sascha Hauer f331ac288f introduce compile time loglevel
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2013-01-27 14:24:39 +01:00
Sascha Hauer a01e54d201 treewide: fix format specifiers
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2013-01-27 14:24:10 +01:00
Jean-Christophe PLAGNIOL-VILLARD b1da925c8a introduce console none support
this will allow to have no console support

Use full for bootstrap as we can save 6.5 KiB (barebox.bin) and
3.8 KiB (zbarebox.bin lzo) on at91sam9263 as example vs console simple

As on bootstrap we have often very limited size.

Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2013-01-23 20:34:16 +01:00
Jean-Christophe PLAGNIOL-VILLARD 2bdc28c475 console: switch select to choice
so we can add easly the console_none support

Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2013-01-23 20:34:16 +01:00
Jean-Christophe PLAGNIOL-VILLARD 03939c0dfb filetype: add is_barebox_mips_head support
Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2013-01-22 22:03:44 +01:00
Sascha Hauer d40e6e1476 filetype: Make buf in file_detect_type const
This function has no business changing the buffer.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2013-01-20 16:33:03 +01:00
Sascha Hauer 0e18d5ae7f defaultenv loading: rework to use less ifdefs/defines
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2013-01-20 16:33:03 +01:00
Sascha Hauer 0bbb021b48 startup: add __noreturn to start_barebox
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2013-01-20 16:33:03 +01:00
Sascha Hauer 7ed52f8870 startup: Use IS_ENABLED for loading environment
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2013-01-20 16:33:03 +01:00
Sascha Hauer a32ba93239 startup: use IS_ENABLED instead of ifdef
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2013-01-20 16:33:02 +01:00
Sascha Hauer 0c97dd0061 move prototypes for envfs_* to envfs.h
environment.h is for environment variables, not for the environment
storage (envfs), so move the prototypes to envfs.h

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2013-01-20 16:31:51 +01:00
Sascha Hauer 00df6b4637 make file_*_action static
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2013-01-20 16:30:22 +01:00
Sascha Hauer 5531abd16d move struct action_data to the only file using it
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2013-01-20 16:30:22 +01:00
Sascha Hauer 7b4d66ab28 startup: call a barebox_main function pointer at the end of the startup
Currently Kconfig dependencies are used to allow non-interactive builds.
This leads to problems in Kconfig getting the dependencies right.

This patch adds a barebox_main function pointer which is called at the
end of the startup process. This defaults to run_shell when a shell is
enabled.

With this the HAVE_NOSHELL Kconfig variable can be removed. Non interactive
builds can now be enabled for every board allowing to compile a binary
without further Kconfig dependencies. This also allows for more flexibility,
for example boards may decide to try non-interactive startup first and
call run_shell if that fails.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2013-01-20 16:30:20 +01:00
Sascha Hauer e118761c5f oftree command: refactor
This has several improvements for the oftree command:

- loading a devicetree (-l) and actually probing (-p) it now is separated
- the command now can dump the internal devicetree or a dtb given on the
  command line.
- The -f option now actually frees the internal devicetree

With this the usage pattern for this command is:

oftree -l /env/oftree

oftree -d -n /sound

oftree -d /env/oftree

oftree -f

oftree -p

oftree -l -p /env/oftree

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2013-01-19 11:48:17 +01:00
Sascha Hauer 4979d8e9d5 of: remove unused barebox_fdt
barebox_fdt should once become the pointer to the barebox internal
devicetree. Since barebox has its own internal devicetree format
this was never used. remove it.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2013-01-19 11:48:17 +01:00
Alexander Aring 43afe67390 barebox-data: add barebox-data sections
Add barebox-data section in arm branch to get complete
barebox regions in sdram regions tree.

Signed-off-by: Alexander Aring <alex.aring@gmail.com>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2013-01-18 11:56:50 +01:00
Alexander Aring 4607301951 meminfo: fix display of allocated addresses
Fix display to stdout of allocated addresses.

Signed-off-by: Alexander Aring <alex.aring@gmail.com>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2013-01-14 13:21:39 +01:00
Alexander Aring 3f170cdd58 memory: fix size address calculation
Fix size address calculation.

Global variables from <asm/sections.h> which are defined
in linker script *.lds files for end addresses has already
a +1 calculation.

For example:
stext = 0x100 with a size about 0x50 will result a etext = 0x150.
In this case a correct size calculation is (etext - stext) = 0x50.

In function 'request_sdram_region' the end address will be
calculated with (start + size - 1) which result a correct
end address of 0x149 in this example.

Signed-off-by: Alexander Aring <alex.aring@gmail.com>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2013-01-14 13:21:39 +01:00
Alexander Aring ce50c0b2b1 meminfo: fix missing include
Fix include for linkerscript variables like _etext.
Otherwise build with #define DEBUG will fail.

Signed-off-by: Alexander Aring <alex.aring@gmail.com>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2013-01-14 13:21:39 +01:00
Sascha Hauer f30b191e36 of: make of_get_fixed_tree more universally usable
Currently the bootm code uses of_fix_tree to apply the fixups
to the devicetree given on the command line. This function assumes
that there is enough space for the fixups available. Also on ARM
we have to make sure the tree does not cross 1Mib boundaries.

This patch moves the space allocation and alignment ensurance
to of_get_fixed_tree and uses it in bootm. This is the first
step for making of_get_fixed_tree the single point of devicetree
handling in barebox.
of_get_fixed_tree now takes an argument of the input fdt. If it is
given, this one is used, otherwise an internal oftree is used which
will be created in subsequent patches.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2013-01-11 14:08:30 +01:00
Sascha Hauer 1a9e93cc81 drivers/base: fix corrupt device tree
dev_add_child is a very unsafe function. If called multiple times
it allows setting the same device to different parents thus corrupting
the siblings list. This happens regularly since:

| commit c2e568d19c
| Author: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
| Date:   Sat Nov 3 16:11:05 2012 +0100
|
|    bus: add bus device
|
|    automatically add it as parent of any bus device if none already specified
|
|    we have now a nice output per bus

If for example a FATfs is mounted this nice output per bus often ends with:

>     `---- fat0
>     `---- 0
>          `---- 0x86f0000087020031-0x86f000410df27124: /dev/<NULL>
>          `---- sram00
>               `---- 0x00000000-0xffffffffffffffff: /dev/<NULL>
>               `---- 0x00000000-0xffffffffffffffff: /dev/<NULL>
>               unable to handle NULL pointer dereference at address 0x0000000c
> pc : [<87f08a20>]    lr : [<87f08a04>]
> sp : 86eff8c0  ip : 87f3fbde  fp : ffffffff
> r10: ffffffff  r9 : 00000000  r8 : 00000003
> r7 : 86f075b8  r6 : 00000002  r5 : ffffffec  r4 : 86f07544
> r3 : 00000000  r2 : 43f900b4  r1 : 00000020  r0 : 00000005
> Flags: Nzcv  IRQs off  FIQs off  Mode SVC_32
> [<87f08a20>] (do_devinfo_subtree+0x90/0x130) from [<87f08a90>] (do_devinfo_subtree+0x100/0x130)
>
> [<87f3e070>] (unwind_backtrace+0x0/0x90) from [<87f28514>] (panic+0x28/0x3c)
> [<87f28514>] (panic+0x28/0x3c) from [<87f3e4b8>] (do_exception+0x10/0x14)
> [<87f3e4b8>] (do_exception+0x10/0x14) from [<87f3e544>] (do_data_abort+0x2c/0x38)
> [<87f3e544>] (do_data_abort+0x2c/0x38) from [<87f3e268>] (data_abort+0x48/0x60)

This patch fixes this by adding a device to its parents children list in
register_device so that dev_add_child is no longer needed. This function
is removed from the tree. Now callers of register_device have to clearly
set the parent *before* registering a device.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Reported-by: Jan Lübbe <jlu@pengutronix.de>
2012-12-12 15:04:27 +01:00
Sascha Hauer 8030ab24fa Merge branch 'kconfig' 2012-12-08 12:22:21 +01:00
Alexander Shiyan 4c20f9af97 Cleanup Kconfig files
This patch provides a global cleanup barebox Kconfig files. This includes
replacing spaces to tabs, formatting in accordance format, removing
extraneous lines and spaces. No functional changes.

Signed-off-by: Alexander Shiyan <shc_work@mail.ru>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2012-12-08 12:22:12 +01:00
Sascha Hauer e7509bfbab Merge branch 'for-next/tftp' 2012-12-07 16:43:24 +01:00
Sascha Hauer 86ee7f112f Merge branch 'for-next/misc' 2012-12-07 16:43:15 +01:00
Sascha Hauer 0ae4b1e827 Merge branch 'for-next/imx'
Conflicts:
	arch/arm/mach-imx/include/mach/devices-imx53.h
2012-12-07 16:43:12 +01:00
Sascha Hauer c3a84a3f76 Merge branch 'for-next/ext4' 2012-12-07 16:42:04 +01:00
Sascha Hauer e537392052 Merge branch 'for-next/commands' 2012-12-07 16:42:04 +01:00
Sascha Hauer 4845ffaf0f debug_ll: Add some usage comments
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2012-12-05 19:48:53 +01:00
Enrico Scholz e7111ebd28 password: fixed underflow on <backspace>
due to missing/misplaced boundary check, deleting characters could
underflow the password buffer.

Signed-off-by: Enrico Scholz <enrico.scholz@sigma-chemnitz.de>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2012-12-05 10:38:27 +01:00
Sascha Hauer d2dc3640ef add ext fs detection support
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2012-12-03 11:23:25 +01:00
Sascha Hauer 5e74263762 filetype: Pass bufsize
Pass the buffer size to the file detection code. This makes sure we do not
read past the buffer. This is especially useful for ext filesystem detection
as the magic is at byte offset 1080. Also introduce a FILE_TYPE_SAFE_BUFSIZE
define which is set to the minimum bufsize the detection code needs to detect
all known filetypes.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2012-12-03 11:23:25 +01:00
Sascha Hauer d5af695a87 barebox update: fix finding default handler
It was not possible to register another handler when already
a default handler is registered. Fix this.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2012-12-03 09:57:41 +01:00
Sascha Hauer 1533521bff loadenv: allow more fine grained environment loading
This implements two new options for the loadenv command:

-s: removes (scrubs) old directory contents to be able to
    create a fresh environment from for example /dev/defaultenv
-n: no overwrite. Do not overwrite existing files. This allows
    to keep parts of the old environment.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2012-11-29 20:23:04 +01:00
Vicente Bergas bd2fce751d uimage: fix misunderstanding in common/uimage.c
The option of reading the file at once was discarded because
the option of increasing the buffer size provided almost the
same benefit.

Signed-off-by: Vicente Bergas <vicencb@gmail.com>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2012-11-26 08:42:53 +01:00
Vicente 7b8a200154 uimage: improve transfer speed
Signed-off-by: Vicente <vicencb@gmail.com>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2012-11-16 15:32:27 +01:00
Sascha Hauer 05d251f15f Merge branch 'for-next/of'
Conflicts:
	drivers/of/base.c
	include/of.h
2012-11-16 14:02:44 +01:00
Sascha Hauer 856f60dbd1 Merge branch 'for-next/misc'
Conflicts:
	commands/Makefile

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2012-11-16 14:01:34 +01:00
Sascha Hauer bf38ac7b89 Merge branch 'for-next/imx'
Conflicts:
	arch/arm/boards/guf-neso/lowlevel.c
	arch/arm/boards/pcm038/lowlevel.c
	commands/Makefile
2012-11-16 14:01:09 +01:00
Sascha Hauer ea30283ba0 Merge branch 'for-next/filetype-command' 2012-11-16 14:00:45 +01:00
Sascha Hauer cce8e6ed41 Merge branch 'for-next/console' 2012-11-16 14:00:45 +01:00
Sascha Hauer bc01035f22 Merge branch 'for-next/w1' into for-next/at91 2012-11-15 20:20:12 +01:00
Sascha Hauer 907e3ff3e6 command: return 1 on unknown command
hush now prints the error value if a command returns a value < 0,
so do not return -1 (EPERM) when we encounter an unknown command.
Instead, return 1 so that hush is quiet.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2012-11-01 16:31:07 +01:00
Sascha Hauer 2d1ceaff2f uimage: Fix deleting of temporary file
the uImage support may generate a temporary file which ought to be deleted
after usage. Due to the wrong filename this never happened. Fix this.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2012-10-30 18:39:38 +01:00
Sascha Hauer cc9fffc825 filetype: add shortnames
The filetype strings are not really suitable for shell scripts, so
add a shortname array of filetypes usable for shell scripts.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2012-10-30 15:42:39 +01:00
Jean-Christophe PLAGNIOL-VILLARD ba526393dd console: display Switch to console [csxx] when switching from debug_ll to real console
Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2012-10-30 10:24:39 +01:00
Sascha Hauer 87feda4eb1 environment variables: use linux list
This switches environment variables to use linux list. This is easier
to read. An additional plus is that the environment variables no longer
need an initcall, so malloc is the only requirement for them.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2012-10-30 10:24:12 +01:00
Jean-Christophe PLAGNIOL-VILLARD 0448644294 console: use debug_ll before the console is available
This will allow to have the same feature as earlyprintk in the kernel

Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2012-10-30 10:23:50 +01:00
Jean-Christophe PLAGNIOL-VILLARD cf1670486b clock: introduce non interruptible timeout
is_timeout call poller_call if the timeout is >= 100us

but on 1-wire bus we need to wait 500us and not more than 930us
for the bus reset. So if the poller_call is caller we can not guarantee it.

So for this introduce is_non_interruptible_timeout than we only wait.

Use it for ndelay too.

Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2012-10-29 22:31:18 +01:00
Sascha Hauer bed8fb6de1 Add in-system barebox update infrastructure
Currently in-system update means to write an arbitrary file to
an arbitrary device. There is no sanity check if the flashed image
is of the right type or will fit onto the device. Furthermore some
SoCs need a special preparation step for their images before
flashing them.

This adds a barebox in-system update infrastructure. Boards can
register update handlers which know how to make the board bootable.
The available handlers can be listed to be able to select one,
different force levels give the user the chance to know it better.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2012-10-17 20:23:41 +02:00
Vicente Bergas 03af6cc45c UIMAGE: improve transfer speed
Signed-off-by: Vicente Bergas <vicencb@gmail.com>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2012-10-15 09:21:53 +02:00
Sascha Hauer 68e3e14a64 defaultenv: dependencies fixes
When a build with a compressed default environment is done and then
environment compression is disabled, barebox_default_env.h is not
regenerated because its dependency (now barebox_default_env) is still
up to date. This results in a corrupt default environment.

This patch fixes this by adding a cmd_env_h and changing barebox_default_env.h
to FORCE. As a side effect barebox_default_env.h is no longer generated in
include/generated/ but in common/ as we have to add barebox_default_env.h to
$(targets) (extra-y).

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2012-10-12 18:40:02 +02:00
Franck Jullien e5a8c1e232 common/partitions.c: make use of is_fat_or_mbr
Signed-off-by: Franck Jullien <franck.jullien@gmail.com>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2012-10-12 10:08:19 +02:00
Franck Jullien cbe3457dd8 common/paritions.c: force little endian reads
When reading values from a DOS disk, we need to force a little endian
reading.

Signed-off-by: Franck Jullien <franck.jullien@gmail.com>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2012-10-12 10:07:23 +02:00
Sascha Hauer 3510a4b0f5 console/of: evaluate linux,stdout-path property
When a linux,stdout-path property is given in the devicetree
activate the corresponding console.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2012-10-09 20:58:27 +02:00
Sascha Hauer 386681e294 of: Print model name in banner
If we know the model name from the devicetree print this
in the banner instead of the hardcoded board name.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2012-10-09 20:57:23 +02:00
Sascha Hauer f562646dc8 startup: Print error message when initcall fails
There was a time when we used to panic when initcalls failed. Then
it was changed to totally ignore the return value. Instead, print
an error message now so that the user can get a clue when something
bad happened. So initcalls are now recommended to actually return
negative error codes when something fails.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2012-10-09 08:59:44 +02:00
Sascha Hauer b3dbaa9a60 console: cleanup Kconfig
Use a choice for the CONSOLE_ACTIVATE_* variables, which is the natural
way of specifying mutually exclusive variabled in Kconfig. Also update
the help texts a bit.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2012-10-09 08:57:15 +02:00
Sascha Hauer 2909d4ca4b console: Cleanup console activation
When CONFIG_CONSOLE_ACTIVATE_ALL is set, the banner will never be printed.
Also, the console buffer is emptied when the first console is registered,
even when it's not enabled.

This patch cleans it up in a way that:

- the console buffer is emptied once the first console is activated, not
  when it's registered.
- Make sure that the banner is printed first, so that we can output things
  to the buffer before the banner is printed without ending up in having
  the banner in the middle of the other boot messages.
- Use IS_ENABLED rather than ifdefs

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2012-10-09 08:57:10 +02:00
Sascha Hauer b36cc0f884 memory: return error in barebox_add_memory_bank
When a memory bank is already registered, return an error code
instead of throwing a bug. This can happen if a board has registered
a memory bank and the same bank is then probed from the devicetree.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2012-10-08 00:33:21 +02:00
Sascha Hauer 0b494649fa resource: statically initialize iomem resource
This gets us rid of an initcall and also has the advantage that
request_iomem_region can be called at any time now.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2012-10-07 12:58:10 +02:00
Jean-Christophe PLAGNIOL-VILLARD 3c5327e660 switch all platform_bus device/driver registering to platform_driver/device_register
now register_driver and register_device are for bus only usage.

Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
2012-10-04 15:19:12 +02:00
Sascha Hauer 90d92b359d Merge branch 'for-next/defaultenv-deps' 2012-10-03 21:18:10 +02:00
Sascha Hauer 6021818e3d Merge branch 'for-next/arm-remove-arch-init-ll'
Conflicts:
	arch/arm/include/asm/barebox-arm.h
2012-10-03 21:13:31 +02:00
Sascha Hauer d1e65d2a7b Merge branch 'for-next/remove-fsf-address'
Conflicts:
	drivers/net/miidev.c
	include/miidev.h
2012-10-03 21:12:48 +02:00
Sascha Hauer cd323c0224 Merge branch 'for-next/png'
Conflicts:
	common/filetype.c
	include/filetype.h
2012-10-03 21:12:19 +02:00
Sascha Hauer 6a64024148 Merge branch 'for-next/openrisc' 2012-10-03 21:11:53 +02:00
Sascha Hauer bee8dddbfc Merge branch 'for-next/omap'
Conflicts:
	Makefile
2012-10-03 21:11:48 +02:00
Sascha Hauer 4517b5980f Merge branch 'for-next/misc' 2012-10-03 21:10:57 +02:00
Sascha Hauer 3b02a1ac3a Merge branch 'for-next/fat-detection' 2012-10-03 21:10:37 +02:00
Sascha Hauer ed4645cf13 Merge branch 'for-next/boot-sequence-dhcp'
Conflicts:
	drivers/net/miidev.c
2012-10-03 21:10:30 +02:00
Jean-Christophe PLAGNIOL-VILLARD 4676721b30 defaultenv: enable glovalvar support
This will allow to do not have 2 set of var for defaultenv and the new
defaultenv-2.

Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
2012-10-02 08:57:07 +02:00
Sascha Hauer c8c49c14ae environment generation: Fix dependencies
The dependencies for generating the environment do not work properly:

- If files are removed from the defaultenv, a subsequent make will not
  update the default environment.
- If CONFIG_DEFAULT_ENVIRONMENT_PATH changes, the default environment
  also will not be regenerated.

This patch fixes this by introducing a cmd_env which has the content of
$(ENV_FILES) in the command so that the if_changed mechanism recognizes
a change when $(ENV_FILE) changes. This also results in a nice "  ENV "
string in the build process.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2012-09-28 16:21:44 +02:00
Sascha Hauer 1bc0a26188 environment generation: remove unused CLEAN_FILES
The CLEAN_FILES in common/Makefile are unused. All generated files
are removed from the toplevel Makefile.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2012-09-28 16:21:38 +02:00
Sascha Hauer fd5cd6084a ARM: remove ARCH_HAS_LOWLEVEL_INIT
This is unused now and not needed. We have a board_init_lowlevel. If a
board needs some architecture setup it can always call it from its
board_init_lowlevel.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2012-09-25 09:40:55 +02:00
Franck Jullien 010ee209b7 filetype: Improve FAT detection
We may have some disk with MBR as a first sector. In this case, the
current FAT check returns an error. However, the FAT sector exist and
the MBR can tell us where it is.

This patch add to file_name_detect_type function the ability to find
the FAT boot sector on the first sector of the first partition in case
it is not on sector 0.

It also introduce is_fat_or_mbr to check if a buffer is a FAT boot
or MBR sector

Signed-off-by: Franck Jullien <franck.jullien@gmail.com>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2012-09-20 08:57:58 +02:00
Sascha Hauer 77322aa896 Treewide: remove address of the Free Software Foundation
The FSF address has changed in the past. Instead of updating it
each time the address changes, just drop it completely treewide.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2012-09-17 10:57:41 +02:00
Sascha Hauer 58f3457f4f of: add devicetree probing support
This adds code to probe devices from a devicetree. Most helper
functions are directly imported from Linux.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2012-09-14 11:47:42 +02:00
Franck Jullien 83507f2891 Add OpenRISC Image type
This patch sync the image type list with the kernel in order to add
openrisc support.

Signed-off-by: Franck Jullien <franck.jullien@gmail.com>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2012-09-14 08:39:33 +02:00
Jean-Christophe PLAGNIOL-VILLARD 4732c27030 globalvar: add support to set a value to of all globalvars beginning with 'match'
via c global_set_match and global -r

Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
2012-09-14 00:46:00 +08:00
Jean-Christophe PLAGNIOL-VILLARD 50239e0195 filetype: add PNG support
Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2012-09-12 17:23:34 +02:00
Jean-Christophe PLAGNIOL-VILLARD 2dfb4028b4 filetype: add BMP support
Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2012-09-12 17:22:43 +02:00
Jan Weitzel 75831d1687 xload: get barebox size from barebox_arm_head
Add functions to read the barebox_arm_head, check barebox magicword
and read out the barebox image size.
Create a inital partion of 1Mb to access the barebox image on nand.

Signed-off-by: Jan Weitzel <j.weitzel@phytec.de>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2012-09-07 10:31:54 +02:00
Jan Luebbe ef01e97f6c common: split out meminfo output and make it optional
Signed-off-by: Jan Luebbe <jlu@pengutronix.de>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2012-09-06 12:43:36 +02:00
Sascha Hauer bed1a6ffab Merge branch 'for-next/pbl' 2012-09-05 12:59:29 +02:00
Sascha Hauer d79712f82e Merge branch 'for-next/menu' 2012-09-05 12:59:29 +02:00
Sascha Hauer e5a927883e Merge branch 'for-next/link' 2012-09-05 12:59:29 +02:00
Sascha Hauer 4c9d8da6fe Merge branch 'for-next/hush' 2012-09-05 12:59:29 +02:00
Jean-Christophe PLAGNIOL-VILLARD b65e607923 defautenv: add support of symlink
Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
2012-09-05 03:22:14 +08:00
Jean-Christophe PLAGNIOL-VILLARD acef08abb7 envfs: add support of symlink
Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
2012-09-05 03:22:14 +08:00
Jean-Christophe PLAGNIOL-VILLARD d3cbc61596 envfs: add support of variable inode size
Introduce a struct envfs_inode_end with more data.
Today this will just containt the file mode to be able to add the symlink
support.

But this is compatible with the previous envfs version as they will do not
care about the extra as the previous version is just reading the filename and
then consume the extra data without using them.

Increase the envfs version to 1.0

Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
2012-09-05 03:22:14 +08:00
Jean-Christophe PLAGNIOL-VILLARD ff3058e3bb envfs: introduce version major and minor
they are store in the super block at byte 16th and 17th.

set the verison at 0.1

Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
2012-09-05 03:22:14 +08:00
Jean-Christophe PLAGNIOL-VILLARD 653c767213 filetype: add fat filesystem support
Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
2012-09-04 09:08:39 +02:00
Jean-Christophe PLAGNIOL-VILLARD d9cefaed51 uimage_laod: fix ramdisk support
ramdisk U-Boot expect to ignore the compression type

Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
2012-08-13 14:48:16 +08:00
Jean-Christophe PLAGNIOL-VILLARD 3120585df8 uimage_sdram_flush: fix resource start
The start is the start of the previous resource nor the size of it.

Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
2012-08-13 14:48:15 +08:00
Sascha Hauer 4d902142a5 hush: catch errors from execute_binfmt
execute_binfmt may return negative return values which hush interprets
as 'exit'. Catch this and print an error message instead.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2012-08-10 20:59:58 +02:00
Sascha Hauer 16edced39e hush: Make exit a shell builtin
'exit' used to do its job by returning value < 0. This is a sign
for hush that 'exit' is executed. This has problems:

- Often commands accidently return a negative value. This causes
  the shell to exit.
- execute_binfmt returns a negative value when it does not find
  a binary to execute. This again causes the shell to exit.
  Returning a negative error value seems to be the right thing
  to do, but catching this in the shell would mean that the exit
  command does not work anymore.
- if called without arguments exit is supposed to return the code
  of the last command. As a command exit has no access to this code.

This patch changes exit to be a builtin and also fixes the last return
code problem. While at it, update the help text.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2012-08-10 20:59:55 +02:00
Jean-Christophe PLAGNIOL-VILLARD 0e21e17614 menu: add number key support
Allow to use the number key to jump to entry.
if already on a entry % number_key jump to the next +10 one if exit

Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2012-08-09 08:40:02 +02:00
Jean-Christophe PLAGNIOL-VILLARD 104c39fe82 compressed image: add gzip support
Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
2012-08-03 18:09:15 +08:00
Jean-Christophe PLAGNIOL-VILLARD 5c3db111da Add compressed image support
This allows for creating a lzo compressed binary unsing the pbl.

Only copy the piggydata if needed.

Add CONFIG_PBL_FORCE_PIGGYDATA_COPY option
In some case we need to copy the PIGGYDATA as the link address
as example we run from SRAM and shutdown the SDRAM/DDR for
reconfiguration but most of the time we just need to copy the
executable code.

based on Sascha Hauer
Add compressed image support

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
2012-08-03 18:09:15 +08:00
Jean-Christophe PLAGNIOL-VILLARD 78867e2bbd Add pre-bootloader (pbl) image support
This allows for creating a pre-bootloader binary for
 - nand boot
 - mmc boot
 - compressed image

The pbl will be incharge of the lowlevel init if needed.
The barebox will skip it.

Import string functions from linux 3.4 (arch/arm/boot/compressed/string.c) and
implement a dummy panic.

For now on introduce dummy zbarebox* targets and c code that will contain later
the decompressor. This only implemeted on ARM.

This patch is based on Sascha Hauer <s.hauer@pengutronix.de>
Add compressed image support patch

Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
2012-08-03 18:09:13 +08:00
Sascha Hauer 2935411dea Merge branch 'for-next/reset-source' 2012-08-01 17:49:27 +02:00
Sascha Hauer 88107f6e12 Merge branch 'for-next/randconfig' 2012-08-01 17:49:27 +02:00
Sascha Hauer 9204bf87d6 Merge branch 'for-next/misc' 2012-08-01 17:49:27 +02:00
Sascha Hauer bff2e86495 Merge branch 'for-next/defenv-2' 2012-08-01 17:49:27 +02:00
Jean-Christophe PLAGNIOL-VILLARD d6a50c915f stddev: make it selectable via Kconfig
enable is by default for simple and hush
we do not need to NO_SHELL

this allow to save 1KiB

Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2012-07-25 10:06:30 +02:00
Jean-Christophe PLAGNIOL-VILLARD 14c8c60ac6 command: add missing EXPORT_SYMBOL for find_cmd
Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2012-07-25 09:50:00 +02:00
Jean-Christophe PLAGNIOL-VILLARD e7abb188f5 version: add missing EXPORT_SYMBOL for version_string
Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2012-07-25 09:50:00 +02:00
Jean-Christophe PLAGNIOL-VILLARD 8bc0b0a008 complete: add missing EXPORT_SYMBOL for {command, device, empty, command}_var_complete
Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2012-07-25 09:50:00 +02:00
Sascha Hauer 0daaf9e4c4 uimage: select uncompress and crc32 support
uImage support needs both.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2012-07-25 09:27:28 +02:00
Sascha Hauer a6ce65b121 uimage: introduce UIMAGE Kconfig symbol
Both the uimage command and the bootm command need uImage support, so
add a Kconfig symbol for it to be able to select it properly.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2012-07-25 09:27:27 +02:00
Juergen Beisert 1069567830 Enable a way to provide the reason for "being here"
Many architectures support a way to detect why the bootloader is running.
This patch adds a global variable to be able to use the cause in some kind of
shell code to do special things on demand. For example to do an emergency boot,
when the last boot fails and the watchdog reactivate the hanging system.

Signed-off-by: Juergen Beisert <jbe@pengutronix.de>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2012-07-18 16:21:43 +02:00
Antony Pavlov a540e88965 filetype: add forgotten mips barebox filetype_str
Signed-off-by: Antony Pavlov <antonynpavlov@gmail.com>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2012-07-16 11:08:53 +02:00
Sascha Hauer 4604923f0c defenv-2: improve boot script
- add usage information
- add option parsing:
  -v verbose
  -v -v more verbose
  -l list b´possible boot sources
  -d dryrun

The dryrun option sets the global variables necessary for booting
but does not actually boot the system. This way it is possible to
make additional adjustments to the boot variables and then invoke
bootm manually.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2012-07-05 20:50:45 +02:00
Sascha Hauer 1d3ab47e13 hush getopt: shift argv arguments
Make the nonopt arguments to a script available starting from $1
after running getopt. This allows for scripts which use option
parsing but also have nonopts.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2012-07-04 23:39:05 +02:00
Sascha Hauer 1510c57e93 Merge branch 'for-next/resource-size'
Conflicts:
	drivers/base/resource.c
	fs/fs.c
2012-07-02 11:05:57 +02:00
Sascha Hauer c77dd2a81b Merge branch 'for-next/menu' 2012-07-02 11:02:59 +02:00
Sascha Hauer ecb682dfda Merge branch 'for-next/size-decrease' 2012-07-02 11:00:20 +02:00
Sascha Hauer f22d4e2778 Merge branch 'for-next/sparse' 2012-07-02 10:59:37 +02:00
Sascha Hauer 6e4b15537b Merge branch 'for-next/misc' 2012-07-02 10:59:30 +02:00
Sascha Hauer dd3c898d06 Merge branch 'for-next/dma-cache-align' 2012-07-02 10:59:22 +02:00
Sascha Hauer 5f03074ea9 resource: store 'end' instead of 'size' in struct resource
Storing the size instead of the resource end in struct resource was
a mistake. 'size' ranges from 0 to UINT[32|64]_MAX + 1 which obviously
leads to problems. 'end' on the other hand will never exceed
UINT[32|64]_MAX. Also this way we can express a iomem region covering
the whole address space.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2012-07-01 08:18:53 +02:00
Sascha Hauer 1bb01712a7 of: Fix usage of 0 as NULL pointer
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2012-06-30 22:34:55 +02:00
Sascha Hauer aee2920a88 tlsf: Use NULL instead of 0 for returning NULL pointers
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2012-06-30 22:34:54 +02:00
Sascha Hauer 13b70bb921 menu: implement KEY_HOME/KEY_END
To go to the first/last menu entry.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2012-06-30 20:23:26 +02:00
Sascha Hauer 4f02e70d6d menu: store repaint state in variable
Instead of calling print_menu_entry multiple times in each case, store
the repaint state in a variable and call it once at the end to save a
few bytes of binary space.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2012-06-30 20:23:26 +02:00
Sascha Hauer fa37257ce0 menu: use read_key
We have the read_key function which reads a key and parses escape sequences.
Use it in the menu instead of reimplementing this manually.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2012-06-30 20:23:26 +02:00
Sascha Hauer 4d5a9be0dc complete: fix parameter complete with multiple '.'
When a device parameter has dots in its name, we have to use strchr instead
of strrchr, because the devicename ends at the first dot, not at the last one.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2012-06-30 20:23:26 +02:00
Sascha Hauer cfcfc66d54 partitions: Make 64bit capable
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2012-06-30 16:53:25 +02:00
Sascha Hauer be573120fe make cdev 64bit capable
Next step to 64bit support: Make cdev size a 64bit type.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2012-06-30 16:53:24 +02:00
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