summaryrefslogtreecommitdiffstats
path: root/common
Commit message (Collapse)AuthorAgeFilesLines
* state: hmac: fix error message that algo is displayedMarc Kleine-Budde2016-01-181-4/+4
| | | | | | | | | This patch moves the error message about missing crypto support so that the used crypto algo is printed. Without this patch the algo is always shown as a NULL pointer. Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* hush: Initialize struct p_contextSascha Hauer2016-01-111-3/+3
| | | | | | | The hush context must be initialized before it is used. Add initialization where necessary. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* Merge branch 'for-next/rtc'Sascha Hauer2016-01-111-0/+18
|\
| * hwclock command: use format like the Linux tool doesSascha Hauer2016-01-071-0/+18
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Print three-letter abbreviations of the days and months. With a fixup by Andrey Smirnov: | common/date.c: Fix off-by-one error | | As per http://pubs.opengroup.org/onlinepubs/007908775/xsh/time.h.html | 'tm_wday' is zero indexed with zero representing Sunday, this is also | corroborated by the code in rtc_time_to_tm() which used 4 to represent | Thursday. Signed-off-by: Andrey Smirnov <andrew.smirnov@gmail.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | Merge branch 'for-next/pstore'Sascha Hauer2016-01-111-0/+5
|\ \
| * | fs: Add pstore filesystemMarkus Pargmann2015-12-101-0/+5
| |/ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | pstore is a persistent storage filesystem used for RAMOOPS. It is used to store console logs, panics, ftrace and other information in case of a crash/panic/oops/reboot. pstore is implemented for barebox as a read-only filesystem at the moment. It may be extended later on. The idea is to provide a way to extract essential data from the last running kernel. Most of the code is copied from the kernel. However this is only a lightweight implementation without real write support yet. Signed-off-by: Markus Pargmann <mpa@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | partition: Create links with partition namesSascha Hauer2016-01-081-13/+7
| | | | | | | | | | | | | | When a partition has a name create a link to the original partition rather than registering a second cdev. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | state: implement signed int supportSascha Hauer2016-01-081-3/+22
| | | | | | | | Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | partitions/efi: Add partuuid to partition descriptionTrent Piepho2016-01-082-0/+2
| | | | | | | | | | | | | | | | | | | | In commit bc31d85c6e23d724664e76bcfc3b2eda778012a3 the partition UUID was added to the partition struct and thence to the cdev(s) for the partition. But just for DOS partitions. Do this for GPT aka EFI partitions too. Signed-off-by: Trent Piepho <tpiepho@kymetacorp.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | environment: allow saving of symbolic link changesZahari Doychev2015-12-171-9/+10
|/ | | | | | | | | | | | | | | | | | | | Currently it is not possible to change symbolic links in the default environment. For example if the default environment contains the link "current_boot -> mmc" then the following does not work: $ rm current_boot $ ln net current_boot $ saveenv After reset the link is still pointing to "mmc" and this error appears: "symlink: /env/boot/current_boot -> net : error -17" The patch fixes the above problem and moves the "ENV_FLAG_NO_OVERWRITE" to enable handling of symbolic links in this case too. Signed-off-by: Zahari Doychev <zahari.doychev@linux.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* Merge branch 'for-next/state'Sascha Hauer2015-12-082-37/+162
|\
| * state: backend_raw: add hmac supportMarc Kleine-Budde2015-11-272-8/+137
| | | | | | | | | | | | | | | | | | | | | | | | This patch adds hmac support to the raw backend. With this patch, modifications of the header or data of a state partition can be detected, as the hmac woudln't match anymore. The hmac relies on a shared secret, which is requested from the keystore, with keystore_get_secret() using the name of the state partition as the "name" of the secret. Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * state: prepare raw backend for hmac supportMarc Kleine-Budde2015-11-271-5/+10
| | | | | | | | | | | | | | | | This patch cleans up the raw backend, so that adding hmac support in the next patch is easier. Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * state: disable load commandEnrico Jorns2015-11-271-27/+18
| | | | | | | | | | | | | | | | | | Explicitly loading environment is not required as it will be loaded if available during device probing Signed-off-by: Enrico Jorns <ejo@pengutronix.de> Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | Merge branch 'for-next/omap'Sascha Hauer2015-12-081-31/+0
|\ \
| * | common: filetype: do not redetect MBR-type devices as a FAT-typePeter Mamonov2015-11-231-31/+0
| |/ | | | | | | | | | | | | | | | | | | | | | | | | Deleted pieces of code detect MBR-containig device as a FAT-type device, if it's first partition contains a FAT filesystem. This behaviour enabled one to mount the FAT FS which is either directly on the device (disk0) or on the first partition (disk0.0) using the same command: mount /dev/disk0 /fat However, the desired behaviour can be reached with a: mount /dev/disk0 /fat || mount /dev/disk0.0 /fat || echo "Mounting failed" Signed-off-by: Peter Mamonov <pmamonov@gmail.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | Merge branch 'for-next/misc'Sascha Hauer2015-12-083-42/+75
|\ \
| * | environment: support env on at24 eepromAntony Pavlov2015-12-011-6/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | unprotect(), erase() and protect() return EOPNOTSUPP errno code for at24 I2C eeproms, so envfs_save() doesn't store data to these eeproms without this patch. Signed-off-by: Antony Pavlov <antonynpavlov@gmail.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * | state: make type check error verboseJan Remmet2015-11-231-0/+2
| | | | | | | | | | | | | | | | | | | | | Wrong type let state probe fail with ENOENT. Signed-off-by: Jan Remmet <j.remmet@phytec.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * | bootm: get file type before bootm_open_os_uimageJan Remmet2015-11-201-17/+22
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Using a multi uimage stored in nand didn't work. Only one open for the bb file is allowed. The file type detection after bootm_open_os_uimage will fail. bootm_open_initrd_uimage and bootm_open_oftree_uimage already check if they can reuse data->os. Signed-off-by: Jan Remmet <j.remmet@phytec.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * | bootm: cleanup bootm_open_oftreeJan Remmet2015-11-201-28/+54
| |/ | | | | | | | | | | | | | | Separate oftree file and uimage oftree handling. Make fie_type checks in bootm_boot Signed-off-by: Jan Remmet <j.remmet@phytec.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | Merge branch 'for-next/console'Sascha Hauer2015-12-081-7/+4
|\ \
| * | console: Set baudrate during registrationSascha Hauer2015-11-171-7/+4
| |/ | | | | | | | | | | | | This makes sure that the cdev->baudrate field is always consistent with the hardware state. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | Merge branch 'for-next/arm'Sascha Hauer2015-12-081-3/+0
|\ \
| * | ARM: Remove do_execute and thumb2_executeTrent Piepho2015-12-071-3/+0
| |/ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | In commit 104a6a7ccfb7928ca5dc28c8cbe0ea231ffc45ee support was added for Thumb2. It added do_execute() as a way to provide arch dependent calling veneers for use in "go" and thumb2_execute() as the thumb2 to arm veneer. But thumb2_execute() isn't necessary as gcc generates a proper calling sequence from a standard function pointer call. Thumb2 barebox is compiled with the AAPCS ABI which requires this. It also had a bug and didn't pass the arguments properly, but code execute via "go" rarely uses arguments so this wasn't very noticeable. Since thumb2 was always the only user of do_execute(), go ahead and delete that too. Signed-off-by: Trent Piepho <tpiepho@kymetacorp.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* / Revert "memtest: move error handling to end of function"Sascha Hauer2015-12-041-17/+20
|/ | | | | | | | While this simplifies the code as is I got the request to continue on errors in memtest, which can be better implemented when the messages are printed inline and not at the end of the function. This reverts commit 4ff9e28abc2e31dabde6d71503219b3e50d9f4e3.
* Merge branch 'for-next/misc'Sascha Hauer2015-11-063-11/+13
|\
| * filetype: Use cdev_openSascha Hauer2015-10-151-1/+3
| | | | | | | | | | | | | | a cdev has to be opened before usage. Use cdev_open instead of cdev_by_name. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * common/parser.c: Do not treat zero return code as errorAndrey Smirnov2015-10-151-8/+7
| | | | | | | | | | | | | | | | | | Run_command() would return zero to indicated success so treating it as error case would completely break command repetition logic, so change comparinson operator from "less or equal" to "less then" Signed-off-by: Andrey Smirnov <andrew.smirnov@gmail.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * common/parser.c: Do not conflate error reporting disciplinesAndrey Smirnov2015-10-151-1/+2
| | | | | | | | | | | | | | | | | | | | | | | | Run_command() uses 0 to indicate success and negative values to indicate errors, whereas execute_command() uses 0 for success and positive integers to represent error codes. Conflating the two breaks the code that calls run_command and then checks for error code sign to detect problems, so avoid that by doing a very simple transformation on the result of execute_command Signed-off-by: Andrey Smirnov <andrew.smirnov@gmail.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * common/command.c: Replace magic number with appropriate constantAndrey Smirnov2015-10-151-1/+1
| | | | | | | | | | Signed-off-by: Andrey Smirnov <andrew.smirnov@gmail.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | Merge branch 'for-next/memtest'Sascha Hauer2015-11-061-94/+175
|\ \
| * | memtest: By default only test biggest regionSascha Hauer2015-11-041-0/+16
| | | | | | | | | | | | | | | | | | | | | | | | | | | Often enough the biggest free region spans most free RAM, so it doesn't add much value to test the remaining free regions. This patch changes the default behaviour to only test the biggest free region and adds the -t option to test all regions. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * | memtest: move error handling to end of functionSascha Hauer2015-11-041-20/+17
| | | | | | | | | | | | | | | | | | | | | Move error handling out of the test code to make the actual test better visible. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * | memtest: move ctrlc check / progress showing into separate functionSascha Hauer2015-11-041-16/+24
| | | | | | | | | | | | | | | | | | To make the actual test a bit better visible in the code. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * | memtest: Make comments single line when appropriateSascha Hauer2015-11-031-16/+5
| | | | | | | | | | | | | | | | | | | | | Make the comments single line when they fit into a single line to make the code a bit shorter. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * | memtest: Make output more compactSascha Hauer2015-11-031-13/+7
| | | | | | | | | | | | | | | | | | | | | | | | Especially when called multiple times the output of the memory test is quite verbose. Make it more compact by only describing once what is being done and only use one progress bare instead of three. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * | memtest: split tests in separate functionsSascha Hauer2015-11-031-35/+1
| | | | | | | | | | | | | | | | | | | | | | | | The memtest does a bus integrity check and a moving inversions test. Split the tests into two separate functions so that the can be called separately. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * | rework remap_rangeSascha Hauer2015-11-031-3/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | remap_range is for remapping regions with different cache attributes. It is implemented for ARM and PowerPC only, the other architectures only provide stubs. Currently the new cache attributes are passed in an architecture specific way and the attributes have to be retrieved by calls to mmu_get_pte_cached_flags() and mmu_get_pte_uncached_flags(). Make this simpler by providing architecture independent flags which can be directly passed to remap_range() Also provide a MAP_ARCH_DEFAULT flag and a arch_can_remap() function. The MAP_ARCH_DEFAULT defaults to whatever caching type the architecture has as default. the arch_can_remap() function returns true if the architecture can change the cache attributes, false otherwise. This allows the memtest code to better find out what it has to do. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * | memtest: move request/release regions to common/Sascha Hauer2015-10-271-0/+112
| | | | | | | | | | | | | | | | | | | | | | | | Normally code providing a feature should be implemented in common/ which is then called from the command code. Follow this rule and move some more of the memtest code to common/. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | | hush: Add missing initialize_context() in some placesSascha Hauer2015-11-051-0/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | Before a context can be used it must be initialized. This was forgotten in several places. Add the missing calls to initialize_context(). This fixes crashes when sourcing empty files Reported-by: Wjatscheslaw Stoljarski <wjatscheslaw.stoljarski@kiwigrid.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | | login: make some locally used functions staticSergey Koshechkin2015-11-021-6/+3
|/ / | | | | | | | | | | | | | | | | | | | | | | | | This patch continues cleanup password code from commit 40596b856f61c281fb34f804bf42550c099f26c3 Author: Sascha Hauer <s.hauer@pengutronix.de> Date: Thu Aug 27 15:58:50 2015 +0200 login: cleanup password code Signed-off-by: Sergey Koshechkin <tritel59@gmail.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* / common/Makefile: Add missing dependencySascha Hauer2015-10-161-0/+1
|/ | | | | | imd-barebox.o needs include/generated/compile.h. Add the dependency. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* Merge branch 'for-next/usb'Sascha Hauer2015-10-071-0/+9
|\
| * common: clock: introduce mdelay_non_interruptible()Peter Mamonov2015-10-021-0/+9
| | | | | | | | | | Signed-off-by: Peter Mamonov <pmamonov@gmail.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | Merge branch 'for-next/omap'Sascha Hauer2015-10-071-0/+37
|\ \
| * | detect_fs: use device instead of fileVicente Bergas2015-10-021-0/+37
| |/ | | | | | | | | | | | | | | detect_fs would usually mount a device on a directory, so, use a device-specific type detection. Signed-off-by: Vicente Bergas <vicencb@gmail.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | Merge branch 'for-next/misc'Sascha Hauer2015-10-072-4/+4
|\ \
| * | of_fix_tree: warn instead of fail when a fixup failsSascha Hauer2015-09-231-1/+2
| | | | | | | | | | | | Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * | introduce strerrorpSascha Hauer2015-09-231-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | putting an error pointer into strerror can be a bit confusing since strerror takes a positive error code but PTR_ERR returns a negative number, so we have to do strerror(-PTR_ERR(errp)). Some places got this wrong already, so introduce a strerrorp function which directly takes an error pointer. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>