summaryrefslogtreecommitdiffstats
path: root/common
Commit message (Collapse)AuthorAgeFilesLines
* include: Move bulk of boot.h to bootm.hSascha Hauer2016-07-263-3/+4
| | | | | | | | The majority of the stuff currently in include/boot.h is about bootm code implemented common/bootm.c. To be more consistent move it to a new file include/bootm.h. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* blspec: Remove once/default handlingSascha Hauer2016-07-221-56/+1
| | | | | | | | This is widely unused and in the way of subsequent cleanups. If you are indeed using it please complain on the list, we'll find a solution to add it back in a different way. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* blspec: remove unused blspec_boot_devicenameSascha Hauer2016-07-221-30/+0
| | | | Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* Merge branch 'for-next/state'Sascha Hauer2016-07-1113-1721/+3395
|\
| * state: also append backend storage stridesizeMichael Grzeschik2016-07-083-0/+10
| | | | | | | | | | Signed-off-by: Michael Grzeschik <m.grzeschik@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * state: Refactor state frameworkMarkus Pargmann2016-07-0813-1721/+3385
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The state framework grew organically over the time. Unfortunately the architecture and abstractions disappeared during this period. This patch refactors the framework to recreate the abstractions. The main focus was the backend with its storage. The main use-case was to offer better NAND support with less erase cycles and interchangeable data formats (dtb,raw). The general architecture now has a backend which consists of a data format and storage. The storage consists of multiple storage buckets each holding exactly one copy of the state data. A data format describes a data serialization for the state framework. This can be either dtb or raw. A storage bucket is a storage location which is used to store any data. There is a (new) circular type which writes changes behind the last written data and therefore reduces the number of erases. The other type is a direct bucket which writes directly to a storage offset for all non-erase storage. Furthermore this patch splits up all classes into different files in a subdirectory. This is currently all in one patch as I can't see a good way to split the changes up without having a non-working state framework in between. The following diagram shows the new architecture roughly: .----------. | state | '----------' | | v .----------------------------. | state_backend | |----------------------------| | + state_load(*state); | | + state_save(*state); | | + state_backend_init(...); | | | | | '----------------------------' | | The format describes | | how the state data | '-------------> is serialized | .--------------------------------------------. | | state_backend_format <INTERFACE> | | |--------------------------------------------| | | + verify(*format, magic, *buf, len); | | | + pack(*format, *state, **buf, len); | | | + unpack(*format, *state, *buf, len); | | | + get_packed_len(*format, *state); | | | + free(*format); | | '--------------------------------------------' | ^ ^ | * * | * * | .--------------------. .--------------------. | | backend_format_dtb | | backend_format_raw | | '--------------------' '--------------------' | | | v .----------------------------------------------------------. | state_backend_storage | |----------------------------------------------------------| | + init(...); | | + free(*storage); | | + read(*storage, *format, magic, **buf, *len, len_hint); | | + write(*storage, *buf, len); | | + restore_consistency(*storage, *buf, len); | '----------------------------------------------------------' | The backend storage is responsible to manage multiple data copies and distribute them onto several buckets. Read data is verified against the given format to ensure that the read data is correct. | | | | | v .------------------------------------------. | state_backend_storage_bucket <INTERFACE> | |------------------------------------------| | + init(*bucket); | | + write(*bucket, *buf, len); | | + read(*bucket, **buf, len_hint); | | + free(*bucket); | '------------------------------------------' ^ ^ ^ * * * * * * A storage bucket represents*exactly one data copy at one data location. A circular b*cket writes any new data to the end of the bucket (for *educed erases on NAND). A direct bucket directly writ*s at one location. * * * * * * * * * .-----------------------. * .-------------------------. | backend_bucket_direct | * | backend_bucket_circular | '-----------------------' * '-------------------------' ^ * ^ | * | | * | | * | | .-----------------------. | '--| backend_bucket_cached |---' '-----------------------' A backend_bucket_cached is a transparent bucket that directly uses another bucket as backend device and caches all accesses. Signed-off-by: Markus Pargmann <mpa@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | Merge branch 'for-next/nvdevvars'Sascha Hauer2016-07-111-24/+127
|\ \
| * | Introduce non volatile device variablesSascha Hauer2016-07-061-10/+127
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Non volatile device variables are used to make device parameters persistent. They are like normal non volatile variables, but set the values of the device parameters with the corresponding name. Every nv variable beginning with nv.dev is a non volatile device variable. They have the form nv.dev.<devname>.<paramname> and act on the parameter <paramname> of the device named <devname>. The non volatile device variables are designated for example for video modes, ethernet device ip addresses or mtd partitioning. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * | nvvar: Simplify by using dev_set_param()Sascha Hauer2016-07-061-6/+1
| | | | | | | | | | | | | | | | | | | | | The combination of get_param_by_name()/param->set() can be replaced by using dev_set_param() Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * | nvvar: Simplify by using nv_set()Sascha Hauer2016-07-061-11/+2
| | | | | | | | | | | | Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | | Merge branch 'for-next/misc'Sascha Hauer2016-07-111-0/+1
|\ \ \
| * | | Add more files to .gitignoreAlexander Shiyan2016-07-051-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This patch adds more generated files to ignore list. ... shc@shc /home/git/barebox-github $ git status На ветке imx51 Неотслеживаемые файлы: (используйте «git add <файл>…», чтобы добавить в то, что будет включено в коммит) common/barebox_default_env common/barebox_default_env.h include/asm scripts/basic/docproc ничего не добавлено в коммит, но есть неотслеживаемые файлы (используйте "git add", чтобы отслеживать их) Signed-off-by: Alexander Shiyan <shc_work@mail.ru> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | | | Merge branch 'for-next/arm64'Sascha Hauer2016-07-111-0/+1
|\ \ \ \
| * | | | uimage: add define for ARM64 architectureRaphael Poggi2016-07-061-0/+1
| | |/ / | |/| | | | | | | | | | | | | | Signed-off-by: Raphael Poggi <poggi.raph@gmail.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | | | Merge branch 'for-next/arm'Sascha Hauer2016-07-111-2/+0
|\ \ \ \ | |_|_|/ |/| | |
| * | | common: Kconfig: Remove orphaned dependency LOAD_PBL_SRAMAlexander Shiyan2016-06-281-2/+0
| | |/ | |/| | | | | | | | | | Signed-off-by: Alexander Shiyan <shc_work@mail.ru> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | | imx-bbu-nand-fcb: avoid double free of dbbt_entriesLucas Stach2016-07-071-1/+0
| | | | | | | | | | | | | | | | | | | | | The error path properly frees them already. Signed-off-by: Lucas Stach <dev@lynxeye.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | | imx-bbu-nand-fcb: don't drop error return codeLucas Stach2016-07-071-2/+2
| |/ |/| | | | | | | | | | | | | | | bit_to_flip might be negative if any uncorrectable bitflips occured. Use int instead of unsigned type in order to properly propagate the error. Signed-off-by: Lucas Stach <dev@lynxeye.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | defaultenv-2: select BOOTMLucas Stach2016-06-241-0/+1
|/ | | | | | | defualtenv-2 selects CMD_BOOT, which in turn needs BOOTM. Signed-off-by: Lucas Stach <l.stach@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* Merge branch 'for-next/misc'Sascha Hauer2016-06-141-2/+7
|\
| * partitions: dos: add partuuid string for logical partitionsUwe Kleine-König2016-05-101-2/+7
| | | | | | | | | | | | | | | | | | | | | | Commit bc31d85c6e23 ("cdev: Add partuuid string to struct cdev") added partuuid strings for dos partitions but only for the (up to) four primary partitions. Do the same for the logical partitions. Their numbers start at 5 independently of the number of available primary partitions. 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/bootm'Sascha Hauer2016-06-145-28/+170
|\ \
| * | bootm: make verbosity controllable via global variableSascha Hauer2016-05-111-0/+5
| | | | | | | | | | | | | | | | | | | | | | | | When the bootm code is not called directly by the bootm command it is useful to control the verbosity with a globalvar. This introduces global.bootm.verbose for this. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * | bootm: Move magicvar descriptions to common/bootm.cSascha Hauer2016-05-111-0/+10
| | | | | | | | | | | | | | | | | | | | | | | | Now that the bootm code can be used without the command, we have to move the magicvar descriptions from the command code to the common bootm code aswell. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * | bootm: Add verify mode "available"Sascha Hauer2016-05-102-19/+46
| | | | | | | | | | | | | | | | | | | | | | | | | | | The verify "available" mode checks whatever is available in the booted image, so when an image has a signature, it is checked and must be correct and when an image is hashed, it is also checked for correctness. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * | bootm: set bootm_verify_mode to correct valueSascha Hauer2016-05-101-0/+4
| | | | | | | | | | | | | | | | | | | | | | | | When CONFIG_BOOTM_FORCE_SIGNED_IMAGES is enabled bootm_verify_mode shall be forced to "signature", so set bootm_verify_mode to this value during startup. Otherwise it shows up as "<NULL>" in devinfo. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * | bootm: fit: Print error when image is not signedSascha Hauer2016-05-101-1/+4
| | | | | | | | | | | | | | | | | | | | | | | | when fit is configured to force signed images then print an error message when an unsigned image is opened to give the user a clue what went wrong. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * | bootm: fit: Print error when image is not hashedSascha Hauer2016-05-101-2/+5
| | | | | | | | | | | | | | | | | | | | | When fit is configured to check hashes print an error when an image does not contain hashes instead of failing silently. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * | bootm: Add missing BOOTM_FORCE_SIGNED_IMAGES optionSascha Hauer2016-05-101-0/+9
| | | | | | | | | | | | | | | | | | | | | The code already tests for this option, but it does not yet exist. Add the option to force using signed images. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * | bootm: Move bootm options to common/KconfigSascha Hauer2016-05-104-10/+91
| |/ | | | | | | | | | | | | | | | | | | | | | | bootm has a C API, so the bootm options have to depend on the option providing the bootm code (CONFIG_BOOTM), not on the option providing the command (CONFIG_CMD_BOOTM). Fixing the dependencies makes it possible to fully use bootm from C without enabling the bootm command support. This also removes the CMD_ prefix from the options which means we have to update the defconfigs aswell. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | state: select CRC32Lucas Stach2016-06-031-0/+1
| | | | | | | | | | | | | | | | The raw state backend uses crc32 unconditionally, so make sure it's present. Signed-off-by: Lucas Stach <l.stach@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | common: select dependencies for defaultenv-2Lucas Stach2016-05-301-0/+3
| | | | | | | | | | | | | | | | | | Now that GLOBALVAR and NVVAR are user visible options they need to be selected when selecting the global and nv command support which uses them. Signed-off-by: Lucas Stach <l.stach@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | console: Fix initial value of baudrate parameterSascha Hauer2016-05-261-1/+1
| | | | | | | | | | | | | | | | The 'baudrate' parameter has the wrong value initially, it has to be set to CONFIG_BAUDRATE. Otherwise a devinfo shows a baudrate of 0 until actively changed. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | imd: make it work on big-endian machinesAntony Pavlov2016-05-231-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The commit commit 5e335773e0814173b40873a891964a7858d64688 Author: Sascha Hauer <s.hauer@pengutronix.de> Date: Tue Mar 29 10:06:46 2016 +0200 imd: use struct imd_header * as argument introduces additional imd type checks like this if (!imd_is_string(imd->type)) return NULL; These checks work incorrectly on any big-endian machine because the imd->type field needs addition conversion to little-endian byteorder before use. Here is the imd command output on big-endian qemu-malta: barebox:/ imd /dev/nor0.barebox release: <NULL> build: <NULL> This patch fixes the problem by adding necessary conversion via imd_read_type(). Signed-off-by: Antony Pavlov <antonynpavlov@gmail.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | imx-bbu-nand-fcb: add missing newline characterStefan Christ2016-05-191-2/+2
| | | | | | | | | | Signed-off-by: Stefan Christ <s.christ@phytec.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | reset_source: export reset_source_set_priorityAlexander Stein2016-05-131-1/+1
|/ | | | | | | | | | | In commit 4a7534bf07e ("reset-source: Allow different priorities") the function name changed from reset_source_set to reset_source_set_priority. Do that change in EXPORT_SYMBOL() accordingly. reset_source_set still exists but is a static inline now. Fixes: 4a7534bf07e ("reset-source: Allow different priorities") Signed-off-by: Alexander Stein <alexander.stein@systec-electronic.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* Merge branch 'for-next/ubiformat'Sascha Hauer2016-05-093-0/+689
|\
| * ubiformat: use default values for ubi_ver and image_seqSascha Hauer2016-04-261-0/+6
| | | | | | | | Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * commands: ubiformat: move code to common/Sascha Hauer2016-04-263-0/+683
| | | | | | | | | | | | | | This is the final step to separate the ubiformat code from the command. With this the ubiformat code gains a C API. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | Merge branch 'for-next/misc'Sascha Hauer2016-05-095-21/+64
|\ \
| * | Kconfig: Create Kconfig symbol for NVVARSascha Hauer2016-04-282-2/+31
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | nvvar support not only needs globalvar, but also persistent environment storage. Add a separate default-y option which depends on ENV_HANDLING for this case. Make the option visible to let the user decide whether he wants to have this option and add a help text to make this decision easier. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * | Kconfig: Make ENV_HANDLING visibleSascha Hauer2016-04-281-5/+11
| | | | | | | | | | | | | | | | | | | | | | | | | | | ENV_HANDLING is usable even without explicit loadenv/saveenv command support. Instead of selecting this option from loadenv/saveenv, make this option visible. loadenv/saveenv can then depend on ENV_HANDLING rather than selecting it. This reduces Kconfig dependencies hassles. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * | Kconfig: Make GLOBALVAR visibleSascha Hauer2016-04-281-3/+9
| | | | | | | | | | | | | | | | | | | | | | | | | | | Currently global environment variables are only enabled when the "global" command is enabled. In fact, they could be used even with the "global" command disabled, so make the GLOBALVAR option visible. While at it, add a help text for this option. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * | state: Fix Kconfig dependenciesSascha Hauer2016-04-281-1/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | State support does not need OF_BAREBOX_DRIVERS and never did, so drop the dependency there. It's the state driver which needs of_find_path(), since this symbol now is always enabled when OF is enabled, we don't have to add the dependency to the state driver, but instead can depend on OFDEVICE. We could depend on OF instead, but compiling the state driver without OFDEVICE makes no sense. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * | whole tree: remove trailing whitespacesDu Huanpeng2016-04-212-4/+4
| | | | | | | | | | | | | | | Signed-off-by: Du Huanpeng <u74147@gmail.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * | menu: add vi like key supportDu Huanpeng2016-04-191-6/+9
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | add vi like key support: j: down k: up <Space>: select Signed-off-by: Du Huanpeng <u74147@gmail.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | | Merge branch 'for-next/include-cleanup'Sascha Hauer2016-05-0919-63/+67
|\ \ \
| * | | stdio: Replace FILE functions with filedescriptor functionsSascha Hauer2016-04-153-20/+10
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | We have defined stdin, stdout and stderr as integer file descriptors, but normally they should be FILE *. Also fprintf, fputc and fputs take file descriptors instead of FILE *. As FILE * are inconvenient in the barebox environment replace the f* functions with the corresponding d* functions. dprintf is POSIX conform whereas dputc and dputs are barebox specific, but do not conflict with any stdc function. fgetc is unused and can be removed without replacing it. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * | | stdio: replace fprintf(stderr,...) with eprintfSascha Hauer2016-04-151-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | We have a shortcut for fprintf(stderr, so use it. This is done to be able to remove fprintf in the next step. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * | | stdio: rename getc to getcharSascha Hauer2016-04-154-10/+10
| | | | | | | | | | | | | | | | | | | | | | | | | | | | The function we have implemented as getc has the semantics of the standard function getchar, so rename it accorgingly. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>