summaryrefslogtreecommitdiffstats
path: root/common
Commit message (Collapse)AuthorAgeFilesLines
* don't cast negative error codes to unsigned size_tLucas Stach2014-04-231-3/+3
| | | | | | | The cast prevents us from doing proper error checking. Signed-off-by: Lucas Stach <dev@lynxeye.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* treewide: fix signedness mixups in printf format specifiersLucas Stach2014-04-231-1/+1
| | | | | | | | | This most likely doesn't fix any real bugs, but it's the right thing to do and reduces the noise level with static checkers. Signed-off-by: Lucas Stach <dev@lynxeye.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* loadenv: detect truncated environment filesSascha Hauer2014-04-091-7/+24
| | | | | | | | Properly detect when an environment file is truncated. This can happen when a previous saveenv failed because the environment partition is too small. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* saveenv: Properly detect write errorsSascha Hauer2014-04-091-6/+14
| | | | | | | | | | | The return value check of the write call is completely bogus. We check if we have written at minimum sizeof(struct envfs_super) bytes instead of all bytes. Properly check for all bytes written instead and allow write to write less bytes than requested. Do not use write_full because this file is compiled for userspace aswell. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* Merge branch 'for-next/ppc'Sascha Hauer2014-04-041-0/+24
|\
| * common: DDR3 SPD verification supportRenaud Barbier2014-03-181-0/+24
| | | | | | | | | | | | | | | | | | Add DDR3 SPD verification support for use by the PPC 8xxx DDR driver. This is based on the equivalent files from U-Boot version git-be937b5. Signed-off-by: Renaud Barbier <renaud.barbier@ge.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | Merge branch 'for-next/menutree'Sascha Hauer2014-04-044-1/+219
|\ \
| * | defenv-2: replace menu with menutreeSascha Hauer2014-03-281-1/+1
| | | | | | | | | | | | | | | | | | This makes the menu easier to extend and to maintain. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * | add menutree commandSascha Hauer2014-03-283-0/+185
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Creating menus from the shell using the regular 'menu' command is rather complicated. This adds a 'menutree' command which creates a menu from a directory structure. In the directory structure each directory corresponds to a single menu entry. The directory contains the following files: title - A file containing the title of the entry as shown in the menu box - If present, the entry is a 'bool' entry. The file contains a variable name from which the current state of the bool is taken from and saved to. action - if present this file contains a shell script which is executed when when the entry is selected. If neither 'box' or 'action' are present this entry is considered a submenu containing more entries. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * | Add shell_expand functionSascha Hauer2014-03-281-0/+33
| | | | | | | | | | | | | | | | | | shell_expand expands shell variables in a string. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | | Merge branch 'for-next/boot'Sascha Hauer2014-04-041-2/+79
|\ \ \
| * | | blspec: Check if an entry is compatible with the current machineSascha Hauer2014-03-241-2/+79
| | |/ | |/| | | | | | | | | | | | | | | | | | | | | | When a bootspec entry has the 'devicetree' property specified, check if the tree is compatible with the currently running machine, otherwise ignore the entry. This makes it possible to have entries for multiple machines on an SD card and pick a suitable one. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | | environment: Fix unitiliazed variableSascha Hauer2014-03-291-5/+5
| |/ |/| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | envfs_load_data needs a pointer to the envfs_super, otherwise it works on an unitialized struct when detecting the envfs version. This is broken since: | commit 0a2a8f7059e6cb11e5d4eb882538b37f99d09ee3 | Author: Sascha Hauer <s.hauer@pengutronix.de> | Date: Thu Feb 20 08:16:01 2014 +0100 | | environment: Add function to load envfs from buffer | | Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de> Grmpf. Most compilers do not issue a warning, only the blackfin gcc 4.3.5 warns about this. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | defaultenv-2: Fix menu files selectionSascha Hauer2014-03-281-1/+1
|/ | | | Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* Merge branch 'for-next/nfs'Sascha Hauer2014-03-076-13/+123
|\ | | | | | | | | Conflicts: defaultenv/defaultenv-2-base/bin/ifup
| * blspec: Add NFS supportSascha Hauer2014-03-071-2/+112
| | | | | | | | | | | | | | | | | | With this barebox can start root filesystems containing bootloader spec entries via NFS. It is used as: boot nfs://<ipaddr>[:<port]//path/to/nfsroot Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * net: Add ifup supportSascha Hauer2014-03-071-0/+1
| | | | | | | | | | | | | | | | The defaultenv-2 has ifup support as a shell script. This patch replaces it with a command which is more robust, can be called from C and now can also bring up all configured interfaces. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * run_command: remove unused flag parameterSascha Hauer2014-03-074-8/+7
| | | | | | | | Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * mount: support filesystem options passed via -oUwe Kleine-König2014-02-102-3/+3
| | | | | | | | | | | | | | | | | | | | | | Similar to mount(8) the barebox command mount now supports passing a string to the file system driver via -o. This is used in the next commit to let the user specify port numbers for nfs mounts. Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | Merge branch 'for-next/misc'Sascha Hauer2014-03-072-5/+16
|\ \ | | | | | | | | | | | | Conflicts: common/environment.c
| * | common/kallsyms.c: Fix sparse warningAlexander Shiyan2014-02-171-4/+4
| | | | | | | | | | | | | | | | | | | | | | | | CHECK common/kallsyms.c common/kallsyms.c:170:12: warning: symbol 'kallsyms_lookup' was not declared. Should it be static? Signed-off-by: Alexander Shiyan <shc_work@mail.ru> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * | common: env: properly propagate error codeLucas Stach2014-02-101-1/+1
| | | | | | | | | | | | | | | Signed-off-by: Lucas Stach <dev@lynxeye.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * | remove redundant NULL check on freeLucas Stach2014-02-101-2/+1
| | | | | | | | | | | | | | | | | | | | | | | | free() already checks the pointer to be non NULL. No need to do it again. Signed-off-by: Lucas Stach <dev@lynxeye.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * | Load PBL into SRAMDavid Vincent2014-02-091-1/+12
| |/ | | | | | | | | | | | | | | | | | | This allows to load all the lowlevel init code, including the uncompressor, inside SRAM and not just the bare init part. This is useful when pbl is used as a first-stage bootloader but is loaded by an external firmware. Signed-off-by: David Vincent <freesilicon@gmail.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | Merge branch 'for-next/gpio-keys'Sascha Hauer2014-03-072-11/+11
|\ \
| * | input: Add BB_ prefix to KEY_ definesSascha Hauer2014-02-172-11/+11
| | | | | | | | | | | | | | | | | | | | | Our KEY_ defines conflict with the standard Linux KEY_ defines, so add a BB_ prefix to them. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | | defaultenv: Add boot option for DFUSascha Hauer2014-02-281-0/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | DFU is for device firmware upgrade, but for development purposes it's sometmes useful to just start a kernel vie DFU. This adds a boot option for doing this and also the corresponding counterpart on the host. With this it's possible to boot a system with: scripts/dfuboot.sh -k linuximage -d dtb -c "root=ubi0:root ubi.mtd=ubi rootfstype=ubifs ignore_loglevel" Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | | defaultenv: Allow multiple defaultenvironment overlaysSascha Hauer2014-02-284-74/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | We can compile barebox for multiple boards at once, but currently they all share a single default environment. This patch adds a defaultenv_append() which boards can call to customize the default environment during runtime. Each board now generate default environment snippets using bbenv-y and add them during runtime with defaultenv_append() Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | | move defaultenv-2 to defaultenv/defaultenv-2-*Sascha Hauer2014-02-211-2/+2
| | | | | | | | | | | | Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | | move defaultenv-1 to defaultenv/defaultenv-1Sascha Hauer2014-02-211-1/+1
| | | | | | | | | | | | Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | | defaultenv: Align defaultenv arraySascha Hauer2014-02-202-11/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The default environment buffer is an unsigned char array and thus may be unaligned. Some decompression algorithms expect the buffer to be sufficiently aligned for u32 accesses. We make this sure by copying the default env to a temporary buffer. Instead of doing this just add a __aligned(4) to the default environment. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | | environment: Add function to load envfs from bufferSascha Hauer2014-02-201-65/+116
| | | | | | | | | | | | Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | | environment: constify argumentsSascha Hauer2014-02-201-2/+2
| | | | | | | | | | | | | | | | | | | | | The directory arguments to envfs_load and envfs_save can be const. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | | filetype: Add detection for barebox environmentSascha Hauer2014-02-201-0/+4
| | | | | | | | | | | | Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | | Kconfig: Select default compression typeSascha Hauer2014-02-193-31/+23
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Instead of asking explicitly for the default environment compression type ask for the in-barebox default compression type. This also adds a DEFAULT_COMPRESSION_SUFFIX make variable which can be used together with the wildcard rules for compressed files to generate compressed files without explicitly support each compression type. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | | defaultenv: use wildcard compression rulesSascha Hauer2014-02-181-11/+0
| | | | | | | | | | | | | | | | | | Now that we have wildcard rules for compresed files use them. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | | defaultenv: simplify env dependenciesSascha Hauer2014-02-181-11/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Finding out whether to rebuild the environment is a difficult task since we have to track all files in a directory. Instead of trying this, just rebuild the environment during every build and only if it differs to the last one overwrite the target. This way make only sees a change when the environment is changed. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | | common/Makefile: reorder targetsSascha Hauer2014-02-181-45/+42
|/ / | | | | | | | | | | | | Reorder targets alphabetically to make the file look nicer, no functional change. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* / bootm: Return error when devicetree file is not a dtbSascha Hauer2014-02-131-0/+1
|/ | | | | | | We check whether the file passed as devicetree actually is a devicetree, but we missed to return an error if it's not. Fix this. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* Merge branch 'for-next/pxa'Sascha Hauer2014-02-031-4/+14
|\
| * reset_source: add reset_source_getSascha Hauer2014-01-291-0/+10
| | | | | | | | | | | | To get reset_source from C code, not only from shell. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * reset_source: rename set_reset_source to reset_source_setSascha Hauer2014-01-291-4/+4
| | | | | | | | | | | | | | To get all reset source related functions into the same function namespace. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | Merge branch 'for-next/misc'Sascha Hauer2014-02-035-8/+48
|\ \
| * | Make generated variables staticAlexander Shiyan2014-02-031-3/+3
| | | | | | | | | | | | | | | Signed-off-by: Alexander Shiyan <shc_work@mail.ru> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * | env: make path arguments to envfs_load/save constSascha Hauer2014-01-271-2/+2
| | | | | | | | | | | | | | | | | | | | | These functions have no business changing the path argument, so make the argument const. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * | environment: Fix wrong Kconfig dependencySascha Hauer2014-01-271-1/+1
| | | | | | | | | | | | | | | | | | DEFAULT_ENVIRONMENT needs ENV_HANDLING, not CMD_LOADENV. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * | environment: Use accessor functions for default environment pathSascha Hauer2014-01-272-1/+14
| | | | | | | | | | | | | | | | | | | | | | | | | | | default_environment_path only exists when CONFIG_ENV_HANDLING is enabled. Boards would have to #ifdef this if they wanted to use default_environment_path. Use accessor functions instead which can be ifdeffed on a single place. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * | console: Set Linux console parameter automaticallySascha Hauer2014-01-221-1/+28
| |/ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Linux specifies the linux,stdout-path property in the /chosen node in the devicetree. Unfortunately this is ignored in most cases. For cases in which barebox uses this property for its own use we translate this into a Linux boot arg with: - the console name provided by the serial driver - the the instance from the 'serial' alias - the baudrate from the actual baudrate. So with this it's for devicetee enabled boards no longer necessary to manually assign a console= parameter. Should a user not want to use the automatically assigned parameter it should do: global.linux.bootargs.console= in the environment. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | bootm: introduce bootm_load_devicetree helperSascha Hauer2014-01-141-0/+63
| | | | | | | | Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | bootm: introduce bootm_load_initrd helperSascha Hauer2014-01-141-0/+38
| | | | | | | | | | | | | | Make the bootm handlers simpler by factoring out an initrd load function. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>