summaryrefslogtreecommitdiffstats
path: root/common
Commit message (Collapse)AuthorAgeFilesLines
* Kconfig: defaultenv-2 select CMD_TESTAlexander Kurz2016-08-221-0/+1
| | | | | | | CMD_TEST is required for scripts in defaultenv-2, e.g. automount. Signed-off-by: Alexander Kurz <akurz@blala.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* bbu: parameters are inverted in error messageRenaud Barbier2016-08-181-2/+2
| | | | | | | | | The error message warning the user that the image is too big for the device has its parameters in the wrong order. Swap the two parameters so that the output makes sense. Signed-off-by: Renaud Barbier <renaud.barbier@ge.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* Merge branch 'for-next/nv'Sascha Hauer2016-08-033-18/+122
|\
| * nv: Allow wildcards when removing NV varsSascha Hauer2016-07-252-8/+11
| | | | | | | | | | | | | | With this patch 'nv -r' can also take "*" and "?" wildcards for nv variables. This makes it easier to remove multiple nv variables. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * lib: Add Kconfig symbol for FNMATCHSascha Hauer2016-07-251-0/+1
| | | | | | | | | | | | | | fnmatch is useful on its own, so make a separate Kconfig symbol and select it from GLOB. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * nv: Use dev_remove_param to delete nv variableSascha Hauer2016-07-221-4/+3
| | | | | | | | | | | | | | | | dev_remove_param() is exactly for the purpose of removing a device parameter, so use this function instead of open coding the functionality. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * nv: Save nv variables on shutdownSascha Hauer2016-07-222-3/+82
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | With this patch nv variables are automatically saved whenever barebox shuts down (that is 'reset' is executed or a kernel is started). With this the additional 'saveenv' step becomes unnecessary. The nv variables are stored in the environment and the estasblished behaviour is that files in the environment must be manually saved using 'saveenv'. This behaviour shall be kept for now, so this patch cannot just call 'saveenv' since that would save the modified environment files aswell. Instead we read the environment from the device, modifiy the nv variables and save the environment back. Since this changes a long existing behaviour messages are printed the first time a nv variable is modified and during shutdown when the variables are actually saved. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * nv: Do not save nv variables while loadingSascha Hauer2016-07-221-5/+27
| | | | | | | | | | | | | | | | When reading nv variables from the storage in /env/nv we do not need to write back the value to the file we just read from. Optimize this a bit and make it unnecessary. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | Merge branch 'for-next/misc'Sascha Hauer2016-08-032-0/+16
|\ \
| * | state: Save on shutdownSascha Hauer2016-07-222-0/+16
| |/ | | | | | | | | | | | | | | | | The state framework is meant for storing persistent variables. To make the state more persistent automatically save it on shutdown. This is now the default behaviour, but can be disabled using a 'save_on_shutdown' variable attached to the state. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | Merge branch 'for-next/boot'Sascha Hauer2016-08-036-202/+489
|\ \
| * | blspec: Turn message back to debug levelSascha Hauer2016-07-261-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | Normally one should not be interested that the blspec code scans a directory. In case blspec is not actively used it might even be confusing, so lower priority of the message in blspec_scan_directory() to pr_debug. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * | boot: add single quotes when printing boot target namesSascha Hauer2016-07-261-3/+3
| | | | | | | | | | | | | | | | | | | | | It's nicer to read when target names have quotes around them, it makes it clear that this is a string passed in somewhere. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * | boot: Move code to common/Sascha Hauer2016-07-263-0/+343
| | | | | | | | | | | | | | | | | | | | | | | | | | | Normally code in commands/ shall only do the option parsing whereas the functionality shall be in common/ to make the code usable from C aswell. Do this in the boot code aswell, move it to common/boot.c and add the function prototypes to include/boot.h Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * | blspec: Make blspec_boot staticSascha Hauer2016-07-261-78/+78
| | | | | | | | | | | | | | | | | | | | | Since blspec_boot is now only used locally we can make it static. Move it up to avoid a static declaration. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * | blspec: separate bootentries from blspec entriesSascha Hauer2016-07-261-1/+27
| | | | | | | | | | | | | | | | | | | | | | | | | | | This completes the separation of the blspec code from the boot code. With this the boot code only handles generic boot entries of type struct bootentry which are embedded into the type (blspec/bootscript) specific structs. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * | bootentries: Add title/descriptionSascha Hauer2016-07-261-5/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | We currently have to special case blspec entries vs. boot scripts in the common boot code since we want to print different informations about them. This adds a 'title' and 'description' which can be filled in with different information by bootscripts and blspec entries and so we get rid of the special handling. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * | blspec: factor out a struct bootentrySascha Hauer2016-07-261-4/+7
| | | | | | | | | | | | Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * | blpec: rename struct lspec -> bootentriesSascha Hauer2016-07-261-29/+29
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The code in common/boot.c collects the different boot entries in lists of type struct blspec, eventhough many of them may not be bootloader spec entries but for example boot scripts. This is the first step of separating the data structures from boot entries and bootloader spec: As struct blspec is merely a container for collecting boot entries We simply rename struct blspec to struct bootentries. No functional change. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * | 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>
* / state: only build circular backend if MTD is enabledLucas Stach2016-07-252-3/+5
|/ | | | | | | | The circular backend depends on MTD symbols and is only useful if MTD is present. Exclude it from the build if MTD is not enabled. Signed-off-by: Lucas Stach <l.stach@pengutronix.de> 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>