summaryrefslogtreecommitdiff
path: root/env
Commit message (Collapse)AuthorAgeFilesLines
* Convert CONFIG_ENV_SPI_* to KconfigPatrick Delaunay2019-03-252-20/+46
| | | | | | | | | | | | | | This converts the following to Kconfig: CONFIG_ENV_SPI_BUS CONFIG_ENV_SPI_CS CONFIG_ENV_SPI_MAX_HZ CONFIG_ENV_SPI_MODE Most of time these value are not needed, CONFIG_SF_DEFAULT with same value is used, so I introduced CONFIG_USE_ENV_SPI_* to force the associated value for the environment. Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
* Revert "env: add spi_flash_read_env function"Heiko Schocher2019-03-131-45/+11
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This reverts commit 9a9d66f5eff0f443de4c2c6ca3e27771ed14b1b4. because it breaks fw_setenv and U-Boot interworking, if U-Boot environment is stored in a SPI-NOR. Reproduce it with: boot linux with empty Environment and store a variable with fw_setenv into it, the Environment is now filled with 0xff: root@ckey5e:10:8e:~# hexdump -C /dev/mtd4 00000000 e9 e8 07 fa 01 62 6f 6f 74 63 6d 64 3d 72 75 6e |.....bootcmd=run| [...] 00000f30 7d 00 75 62 69 62 6f 6f 74 76 6f 6c 3d 32 00 00 |}.ubibootvol=2..| 00000f40 00 ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff |................| Boot now U-Boot prints: Loading Environment from SPI Flash... SF: Detected s25fl128l with page size 256 Bytes, erase size 4 KiB, total 16 MiB *** Warning - bad CRC, using default environment Reason is the above commit, as it only reads until \0\0 is found, and assumes the rest of the Environment space is filled with 0x00, which is not the case when saving an Environment under linux with fw_setenv. Signed-off-by: Heiko Schocher <hs@denx.de> Acked-by: Stefano Babic <sbabic@denx.de>
* Merge branch '2019-01-25-master-imports'Tom Rini2019-01-262-8/+21
|\ | | | | | | | | | | | | | | - snapdragon 820c improvements - poplar updates - DFU + SPL cleanups - Improve the mediatek mmc driver - Other minor cleanups / improvements
| * env: Fix saving environment to "bad CRC" locationSam Protsenko2019-01-261-6/+19
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | In case when the environment on some location is malformed (CRC isn't matching), there is a chance we won't be able to save the environment to that location. For example, consider the case when we only have the environment on eMMC, but it's zeroed out. In that case, we won't be able to "env save" to it, because of "bad CRC" error. That's happening because in env_load() function we consider malformed environment as incorrect one, and defaulting to the location with highest (0) priority, which can be different from one we are dealing with right now (e.g., highest priority can be ENV_FAT on SD card, which is not inserted, but we want to use ENV_MMC on eMMC, where we were booted from). This issue began to reproduce after commit d30ba2315ae3 ("u-boot: remove driver lookup loop from env_save()") on BeagleBone Black, but that commit didn't introduce the wrong logic, it just changed the behavior for default location to use, merely revealing this issue. To fix that, let's implement next logic in env_load(): 1. Try to find out correct environment; if found -- use it 2. If working environment wasn't found, but we found malformed one (with bad CRC), let's use it for further "env save". But make sure to use malformed environment location with highest priority. 3. If neither correct nor malformed environment was found, let's default to environment location with highest priority (0) Steps to reproduce mentioned issue on BeagleBone Black (fixed in this patch): 1. Boot from SD card and erase eMMC in U-Boot shell: => mmc dev 1 => mmc erase 0 100000 => gpt write mmc 1 $partitions 2. Write new SPL and U-Boot to eMMC; the rest of eMMC will stay filled with zeroes 3. Boot from eMMC; try to do: => env save 4. Observe the error (incorrect behavior). Correct behavior: environment should be stored correctly on eMMC, in spite of it has "bad CRC" Fixes: d30ba2315ae3 ("u-boot: remove driver lookup loop from env_save()") Signed-off-by: Sam Protsenko <semen.protsenko@linaro.org> Reviewed-by: Simon Goldschmidt <simon.k.r.goldschmidt@gmail.com>
| * env: common: Return specific error code on bad CRCSam Protsenko2019-01-261-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Callers of env_import*() functions might want to check the case when we have incorrect environment (with bad CRC). For example, when environment location is being defined in env_load(), call chain may look like this: env_load() -> drv->load() = env_mmc_load() -> env_import() Return code will be passed from env_import() all way up to env_load(). Right now both env_mmc_load() and env_import() return -EIO error code, so env_load() can't differentiate between two cases: 1. Driver reports the error, because device is not accessible 2. Device is actually accessible, but environment is broken Let's return -ENOMSG in env_import(), so we can distinguish two cases mentioned above. It will make it possible to continue working with "bad CRC" environment (like doing "env save"), instead of considering it not functional (implemented in subsequent patch). Signed-off-by: Sam Protsenko <semen.protsenko@linaro.org> Reviewed-by: Simon Goldschmidt <simon.k.r.goldschmidt@gmail.com>
* | ARC: Move ENV_SIZE and ENV_OFFSET to KconfigAlexey Brodkin2019-01-251-1/+3
|/ | | | | | | | | | Join the party of some ARM boards and drop more items from include/configs/xxx.h. Signed-off-by: Alexey Brodkin <abrodkin@synopsys.com> Cc: Michal Simek <michal.simek@xilinx.com> Cc: Simon Glass <sjg@chromium.org> Reviewed-by: Tom Rini <trini@konsulko.com>
* Revert "env: sf: fix environment in SPI NOR"Tom Rini2019-01-211-1/+1
| | | | | | | | | Per Heiko the original changes were correct and something is misbehaving on his hardware. This reverts commit 3d5931e5986a49c44cdab845c6751d845812e8d8. Signed-off-by: Tom Rini <trini@konsulko.com>
* env: sf: fix environment in SPI NORHeiko Schocher2019-01-181-1/+1
| | | | | | | | | | | | commit 9a9d66f5eff0 ("env: add spi_flash_read_env function") breaks Environment functionality, as it reads only until 2 \0 are found, but fills the buffer with 0x0 instead 0xff which leads in an incorrect crc sum. Fix: init the read buffer with 0xff instead 0x00 Signed-off-by: Heiko Schocher <hs@denx.de>
* env: add spi_flash_read_env functionHoratiu Vultur2019-01-161-11/+45
| | | | | | | | | | | | | | The spi_flash_read_env function is a wrapper over spi_flash_read, which enables the env to read multiple flash page size from flash until '\0\0' is read or the end of env partition is reached. Instead of reading the entire env size. When it reads '\0\0', it stops reading further the env and assumes that the rest of env is '\0'. This is an optimization for large environments that contain few bytes environment variables. In this case it doesn't need to read the entire environment and only few pages. Signed-off-by: Horatiu Vultur <horatiu.vultur@microchip.com>
* common: command: Add support for $ auto-completionBoris Brezillon2019-01-151-4/+48
| | | | | | | | | | | Add the dollar_complete() function to auto-complete arguments starting with a '$' and use it in the cmd_auto_complete() path such that all args starting with a $ can be auto-completed based on the available env vars. Signed-off-by: Boris Brezillon <boris.brezillon@bootlin.com> [trini: Fix some linking problems] Signed-off-by: Tom Rini <trini@konsulko.com>
* env: sata: Fix saveenv issueYe Li2019-01-091-1/+1
| | | | | | | Wrong env buffer was passed into sata write function, cause the saveenv not work. Signed-off-by: Ye Li <ye.li@nxp.com>
* env: sata: Add missed env location for SATA bootYe Li2019-01-091-0/+3
| | | | | | | | | The env location label ENVL_ESATA is missed in location tables, so when we configure the ENV in SATA, u-boot fails to get correct env location and cause boot hang in board_f. Signed-off-by: Ye Li <ye.li@nxp.com> Reviewed-by: Peng Fan <peng.fan@nxp.com>
* env: sf: define API to override sf environment addressRajesh Bhagat2018-12-041-1/+8
| | | | | | | | Defines env_sf_get_env_addr API to override sf environment address, required to support multiple environment. Signed-off-by: Rajesh Bhagat <rajesh.bhagat@nxp.com> Reviewed-by: York Sun <york.sun@nxp.com>
* env: allow flash and nand env driver to compile togetherRajesh Bhagat2018-12-042-10/+8
| | | | | | | | Define env_ptr as static in flash and nand env driver to allow these to compile together. Signed-off-by: Rajesh Bhagat <rajesh.bhagat@nxp.com> Reviewed-by: York Sun <york.sun@nxp.com>
* arm64: versal: Add support for new Xilinx Versal ACAPsMichal Simek2018-10-161-2/+2
| | | | | | | | | | | | | | | | | | Xilinx is introducing Versal, an adaptive compute acceleration platform (ACAP), built on 7nm FinFET process technology. Versal ACAPs combine Scalar Processing Engines, Adaptable Hardware Engines, and Intelligent Engines with leading-edge memory and interfacing technologies to deliver powerful heterogeneous acceleration for any application. The Versal AI Core series has five devices, offering 128 to 400 AI Engines. The series includes dual-core Arm Cortex™-A72 application processors, dual-core Arm Cortex-R5 real-time processors, 256KB of on-chip memory with ECC, more than 1,900 DSP engines optimized for high-precision floating point with low latency. The patch is adding necessary infrastructure in place without enabling platform which is done in separate patch. Signed-off-by: Michal Simek <michal.simek@xilinx.com>
* fix: env: Fix the SPI flash device setup for DM modeKonstantin Porotchkin2018-09-191-1/+2
| | | | | | | | | | | | | | | For some reason the spi_flash_probe_bus_cs() is called inside the setup_flash_device() with zero values in place of configurated SPI flash mode and maximum flash speed. This code causes HALT error during startup environment relocation on some platforms - namely Armada-38x-GP board. Fix the function call by replacing zeros with the appropriate values - CONFIG_ENV_SPI_MAX_HZ and CONFIG_ENV_SPI_MODE. Signed-off-by: Konstantin Porotchkin <kostap@marvell.com> Cc: Igal Liberman <igall@marvell.com> Cc: Stefan Roese <sr@denx.de> Signed-off-by: Stefan Roese <sr@denx.de>
* env: ubi: Add missing ENV_NAMEMarek Vasut2018-08-241-0/+1
| | | | | | | | | Add missing environment name for UBI, to prevent this NULL in output: Loading Environment from <NULL>... and rather have a valid UBI there: Loading Environment from UBI... Signed-off-by: Marek Vasut <marex@denx.de>
* env: Merge Rockchip, Sunxi, Zynq and ZynqMPMichal Simek2018-08-191-49/+15
| | | | | | | | | | | | There is no reason to have the same Kconfig options for different SoCs separately. The patch is merging them together. Signed-off-by: Michal Simek <michal.simek@xilinx.com> Acked-by: Maxime Ripard <maxime.ripard@bootlin.com> [trini: Fix ENV_SIZE around ENV_IS_NOWHERE] Signed-off-by: Tom Rini <trini@konsulko.com> Signed-off-by: Tom Rini <trini@konsulko.com>
* env: Don't show "Failed" error messageSam Protsenko2018-08-101-5/+9
| | | | | | | | | | | | | | "Failed" error message from env_load() only clutters the log with unnecessary details, as we already have all needed warnings by that time. Example: Loading Environment from FAT... MMC: no card present ** Bad device mmc 0 ** Failed (-5) Let's only print it in case when DEBUG is defined to keep log clear. Signed-off-by: Sam Protsenko <semen.protsenko@linaro.org>
* u-boot: remove driver lookup loop from env_save()Nicholas Faustini2018-07-301-18/+16
| | | | | | | | | | | | | | | | When called with ENVOP_SAVE, env_get_location() only returns the gd->env_load_location variable without actually checking for the environment location and priority. This behaviour causes env_save() to fall into an infinite loop when the low-level drv->save() call fails. The env_save() function should not loop through the environment location list but it should save the environment into the location stored in gd->env_load_location by the last env_load() call. Signed-off-by: Nicholas Faustini <nicholas.faustini@azcomtech.com> Reviewed-by: Simon Goldschmidt <sgoldschmidt@de.pepperl-fuchs.com>
* env: Simplify Makefile using $(SPL_TPL_)York Sun2018-07-212-29/+126
| | | | | | | | Add Kconfig options SPL_ENV_* and TPL_ENV_* and simplify Makefile. This allows SPL/TPL image has different environment setting from full feature U-Boot. Signed-off-by: York Sun <york.sun@nxp.com>
* env: typo in description of ENV_IS_IN_REMOTEHeinrich Schuchardt2018-07-211-1/+1
| | | | | | %s/remove/remote/ Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
* env: add the same prefix to error messages to make it detectable by testsQuentin Schulz2018-07-201-1/+2
| | | | | | | | | | | | | | | The error message should start with `## Error: ` so that it's easily detectable by tests without needing to have a complex regexp for matching all possible error message patterns. Let's add the `## Error: ` prefix to the error messages since it's the one already in use. Suggested-by: Stephen Warren <swarren@wwwdotorg.org> Signed-off-by: Quentin Schulz <quentin.schulz@bootlin.com> Reviewed-by: Simon Glass <sjg@chromium.org> Reviewed-by: Stephen Warren <swarren@nvidia.com> Tested-by: Stephen Warren <swarren@nvidia.com>
* env: common: accept flags on reset to default envYaniv Levinsky2018-07-198-33/+29
| | | | | | | | | | | | | | | | | | | | | | | | | | The function set_default_env() sets the hashtable flags for import_r(). Formally set_default_env() doesn't accept flags from its callers. In practice the caller can (un)set the H_INTERACTIVE flag, but it has to be done using the first character of the function's string argument. Other flags like H_FORCE can't be set by the caller. Change the function to accept flags argument. The benefits are: 1. The caller will have to explicitly set the H_INTERACTIVE flag, instead of un-setting it using a special char in a string. 2. Add the ability to propagate flags from the caller to himport(), especially the H_FORCE flag from do_env_default() in nvedit.c that currently gets ignored for "env default -a -f" commands. 3. Flags and messages will not be coupled together. A caller will be able to set flags without passing a string and vice versa. Please note: The propagation of H_FORCE from do_env_default() does not introduce any functional changes, because currently himport_r() is set to destroy the old environment regardless if H_FORCE flag is set or not. More changes are needed to utilize the propagation of H_FORCE. Signed-off-by: Yaniv Levinsky <yaniv.levinsky@compulab.co.il> Acked-by: Igor Grinberg <grinberg@compulab.co.il>
* cmd: nvedit: set H_INTERACTIVE in do_env_defaultYaniv Levinsky2018-07-191-1/+1
| | | | | | | | | | | | | The function set_default_vars() in common.c adds H_INTERACTIVE to the h_import() flag, but the function has no way of telling if the command actually was user directed like this flag suggest. The flag should be set by the calling function do_env_default() in nvedit.c instead, where the command is certainty user directed. Move the H_INTERACTIVE flag from set_default_vars() to do_env_default(). Signed-off-by: Yaniv Levinsky <yaniv.levinsky@compulab.co.il> Acked-by: Igor Grinberg <grinberg@compulab.co.il>
* cmd: nvedit: propagate envflag to set_default_varsYaniv Levinsky2018-07-191-2/+3
| | | | | | | | | | | | | | | | | | The env_flag in do_env_default() doesn't get propagated and therefore gets ignored by himport_r(). This breaks to ability to "forcibly" reset variables to their default values using the environment command. Scenario example of the problem: # setenv kernel uImage # setenv .flags kernel:so # env default -f kernel ## Error: Can't overwrite "kernel" himport_r: can't insert "kernel=zImage" into hash table Change the call path so it will pass the flag correctly. Signed-off-by: Yaniv Levinsky <yaniv.levinsky@compulab.co.il> Acked-by: Igor Grinberg <grinberg@compulab.co.il>
* env: Added support to save env to spi through KconfigVipul Kumar2018-07-191-0/+28
| | | | | | | | This patch added support to enable CONFIG_ENV_SIZE, CONFIG_ENV_OFFSET and CONFIG_ENV_SECT_SIZE through Kconfig for Zynq and Zynqmp. Signed-off-by: Vipul Kumar <vipul.kumar@xilinx.com> Signed-off-by: Michal Simek <michal.simek@xilinx.com>
* env: Add !ENV_IS_IN_EXT4 dependency to ENV_IS_NOWHEREAlex Kiernan2018-06-131-0/+1
| | | | | | | | If ENV_IS_IN_EXT4 is set you shouldn't be able to select ENV_IS_NOWHERE. Signed-off-by: Alex Kiernan <alex.kiernan@gmail.com> Reviewed-by: Simon Glass <sjg@chromium.org> Tested-by: Petr Vorel <petr.vorel@gmail.com>
* u-boot: Fix several typosShyam Saini2018-06-131-3/+3
| | | | | | | 's/environemnt/environment/' and 's/Environemnt/Environment/' Signed-off-by: Shyam Saini <shyam@amarulasolutions.com>
* SPDX: Convert all of our single license tags to Linux Kernel styleTom Rini2018-05-0720-41/+20
| | | | | | | | | | | | | | | | | | | | When U-Boot started using SPDX tags we were among the early adopters and there weren't a lot of other examples to borrow from. So we picked the area of the file that usually had a full license text and replaced it with an appropriate SPDX-License-Identifier: entry. Since then, the Linux Kernel has adopted SPDX tags and they place it as the very first line in a file (except where shebangs are used, then it's second line) and with slightly different comment styles than us. In part due to community overlap, in part due to better tag visibility and in part for other minor reasons, switch over to that style. This commit changes all instances where we have a single declared license in the tag as both the before and after are identical in tag contents. There's also a few places where I found we did not have a tag and have introduced one. Signed-off-by: Tom Rini <trini@konsulko.com>
* Remove unnecessary instances of DECLARE_GLOBAL_DATA_PTRTom Rini2018-04-273-6/+0
| | | | | | | | We have a large number of places where while we historically referenced gd in the code we no longer do, as well as cases where the code added that line "just in case" during development and never dropped it. Signed-off-by: Tom Rini <trini@konsulko.com>
* env: mmc/fat/ext4: undefined reference to `mmc_initialize'Heinrich Schuchardt2018-04-162-0/+4
| | | | | | | | | | For CONFIG_ENV_FAT_INTERFACE != 'mmc' a link error env/fat.c:93: undefined reference to `mmc_initialize' occurs if CONFIG_MMC_SUPPORT is not enabled. Fixes: 26862b4a40c3 ("env: mmc/fat/ext4: make sure that the MMC sub-system is initialized before using it") Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
* env: Relocate env drivers if manual reloc is requiredSiva Durga Prasad Paladugu2018-04-162-0/+22
| | | | | | | | | | Relocate env drivers if manual relocation is enabled. This patch fixes the issue of u-boot hang incase if env is present in any of the flash devices. Signed-off-by: Siva Durga Prasad Paladugu <sivadur@xilinx.com> Signed-off-by: Michal Simek <michal.simek@xilinx.com> Reviewed-by: Simon Glass <sjg@chromium.org>
* Migrate CONFIG_ENV_VARS_UBOOT_RUNTIME_CONFIG to KconfigAlex Kiernan2018-04-081-0/+7
| | | | | | | | | Convert CONFIG_ENV_VARS_UBOOT_RUNTIME_CONFIG to Kconfig Signed-off-by: Alex Kiernan <alex.kiernan@gmail.com> Reviewed-by: Lukasz Majewski <lukma@denx.de> Reviewed-by: Petr Vorel <petr.vorel@gmail.com> Reviewed-by: Petr Vorel <petr.vorel at gmail.com>
* env: Properly check for BLK supportSjoerd Simons2018-04-061-1/+1
| | | | | | | | | | | | | | | | | | Use CONFIG_IS_ENABLED to see if CONFIG_BLK is enabled. Otherwise SPL compilation breaks on boards which do have CONFIG_BLK enabled but not DM_MMC for the SPL as follows: env/mmc.c: In function ‘init_mmc_for_env’: env/mmc.c:164:6: warning: implicit declaration of function ‘blk_get_from_parent’; did you mean ‘efi_get_ram_base’? [-Wimplicit-function-declaration] if (blk_get_from_parent(mmc->dev, &dev)) ^~~~~~~~~~~~~~~~~~~ efi_get_ram_base env/mmc.c:164:29: error: ‘struct mmc’ has no member named ‘dev’ if (blk_get_from_parent(mmc->dev, &dev)) ^~ Signed-off-by: Sjoerd Simons <sjoerd.simons@collabora.co.uk> Reviewed-by: Simon Glass <sjg@chromium.org>
* Allow providing default environment from fileRasmus Villemoes2018-04-061-0/+18
| | | | | | | | | | | | | | | | | Modifying the default environment via CONFIG_EXTRA_ENV_SETTINGS is somewhat inflexible, partly because the cpp language does not allow appending to an existing macro. This prevents reuse of "environment fragments" for different boards, which in turn makes maintaining that environment consistently tedious and error-prone. This implements a Kconfig option for allowing one to define the entire default environment in an external file, which can then, for example, be generated programmatically as part of a Yocto recipe, or simply be kept in version control separately from the U-boot repository. Tested-by: Sean Nyekjaer <sean.nyekjaer@prevas.dk> Signed-off-by: Rasmus Villemoes <rasmus.villemoes@prevas.dk> Reviewed-by: Lukasz Majewski <lukma@denx.de>
* common: env_embedded: allow fine placement of environment objectChristophe Leroy2018-04-061-4/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | Commit 7653942b10e9e ("common/env_embedded.c: drop support for CONFIG_SYS_USE_PPCENV") dropped the .ppcenv section which was used in linking scripts to allow fine placement of embedded environment sections. This implies that GCC randomly places objects from env/embedded.o and environment is not guaranteed to be located at the correct address: 04003df8 g F .text 00000038 mii_init 04004000 g O .text 00000004 env_size 04004004 g O .text 00002000 environment 04006004 g F .text 00000040 .hidden __lshrdi3 This patch restores this capability by allocating each object marked with __UBOOT_ENV_SECTION__ into a different section. Hence 'environment' will be alone in .text.environment, allowing a fine placement in u-boot.lds with: . = DEFINED(env_offset) ? env_offset : .; env/embedded.o (.text.environment) Fixes: 7653942b10e9e ("common/env_embedded.c: drop support for CONFIG_SYS_USE_PPCENV") Cc: Thomas Petazzoni <thomas.petazzoni@free-electrons.com> Signed-off-by: Christophe Leroy <christophe.leroy@c-s.fr>
* Merge git://git.denx.de/u-boot-sunxiTom Rini2018-04-041-1/+0
|\ | | | | | | Signed-off-by: Tom Rini <trini@konsulko.com>
| * sunxi: disable direct MMC environmentAndre Przywara2018-04-041-1/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | Since the dawn of time for the Allwinner support in mainline U-Boot we store the environment to the SD card and write directly at 544KB from the beginning of the device. This leads to problems when the U-Boot proper image grows beyond 504KB and eventually overlaps. With one release of having the environment preferably in a FAT partition, let's now turn off the MMC variant fallback, so we get back all the space we need to implement features. Signed-off-by: Andre Przywara <andre.przywara@arm.com> Reviewed-by: Jagan Teki <jagan@openedev.com> Acked-by: Maxime Ripard <maxime.ripard@bootlin.com>
* | Convert CONFIG_UBI_SILENCE_MSG to KconfigPetr Vorel2018-03-241-5/+0
| | | | | | | | Signed-off-by: Petr Vorel <petr.vorel@gmail.com>
* | Convert CONFIG_UBIFS_SILENCE_MSG to KconfigPetr Vorel2018-03-241-1/+0
|/ | | | | | | | | | | | | | | | Introduce another difference from upstream (kernel) source in fs/ubifs/super.c: adding preprocessor condition as y variable in mount_ubifs() depends on CONFIG_UBIFS_SILENCE_MSG: fs/ubifs/super.c:1337:15: error: variable ?y? set but not used [-Werror=unused-but-set-variable] long long x, y; Not setting CONFIG_UBIFS_SILENCE_MSG in am335x_igep003x_defconfig and igep0032_defconfig. Although it was defined in their config headers, it depends on CMD_UBIFS which is not set for them. Signed-off-by: Petr Vorel <petr.vorel@gmail.com> Cc: Joe Hershberger <joe.hershberger@ni.com> Cc: Heiko Schocher <hs@denx.de>
* env: mmc/fat/ext4: make sure that the MMC sub-system is initialized before ↵Faiz Abbas2018-02-203-0/+8
| | | | | | | | | | | | | using it When booting from a non-MMC device, the MMC sub-system may not be initialized when the environment is first accessed. We need to make sure that the MMC sub-system is ready in even a non-MMC boot case. Therefore, initialize mmc before loading environment from it. Signed-off-by: Faiz Abbas <faiz_abbas@ti.com>
* env: restore old env_get_char() behaviourGoldschmidt Simon2018-02-163-28/+15
| | | | | | | | | | | | With multiple environments, the 'get_char' callback for env drivers does not really make sense any more because it is only supported by two drivers (eeprom and nvram). To restore single character loading for these drivers, override 'env_get_char_spec'. Signed-off-by: Simon Goldschmidt <sgoldschmidt@de.pepperl-fuchs.com> Acked-by: Maxime Ripard <maxime.ripard@bootlin.com>
* env: Fix env_load_locationYork Sun2018-02-161-5/+3
| | | | | | | | | | | | | Commit 7d714a24d725 ("env: Support multiple environments") added static variable env_load_location. When saving environmental variables, this variable is presumed to have the value set before. In case the value was set before relocation and U-Boot runs from a NOR flash, this variable wasn't writable. This causes failure when saving the environment. To save this location, global data must be used instead. Signed-off-by: York Sun <york.sun@nxp.com> CC: Maxime Ripard <maxime.ripard@free-electrons.com>
* Fix misaligned buffer in env_fat_saveAlex Kiernan2018-02-121-1/+1
| | | | | | | | | | | | When saving the environment on a platform which has DMA alignment larger than the natural alignment, env_fat_save triggers a debug message in file_fat_write: Saving Environment to FAT... writing uboot.env FAT: Misaligned buffer address (9df1c8e0) OK Signed-off-by: Alex Kiernan <alex.kiernan@gmail.com>
* env: sf: use env_import_redund to simplify env_sf_loadSimon Goldschmidt2018-02-011-59/+8
| | | | | | | | | | | For the redundant environment configuration, env_sf_load still contained duplicate code instead of using env_import_redund(). Simplify the code by only executing the load twice and delegating everything else to env_import_redund. Signed-off-by: Simon Goldschmidt <sgoldschmidt@de.pepperl-fuchs.com> Acked-by: Maxime Ripard <maxime.ripard@free-electrons.com>
* env: make env drivers propagate env_import return valueSimon Goldschmidt2018-02-0110-23/+10
| | | | | | | | | | | | | | For multiple env drivers to correctly implement fallback when one environment fails to load (e.g. crc error), the return value of env_import has to be propagated by all env driver's load function. Without this change, the first driver that succeeds to load an environment with an invalid CRC return 0 (success) and no other drivers are checked. Signed-off-by: Simon Goldschmidt <sgoldschmidt@de.pepperl-fuchs.com> Acked-by: Maxime Ripard <maxime.ripard@free-electrons.com>
* env: move more common code to env_import_redundSimon Goldschmidt2018-02-014-50/+34
| | | | | | | | | | | | | | There is more common code in mmc, nand and ubi env drivers that can be shared by moving to env_import_redund. For this, a status/error value whether the buffers were loaded are passed as additional parameters to env_import_redund. Ideally, these are already returned to the env driver by the storage driver. This is the case for mmc, nand and ubi, so for this change, code deduplicated. Signed-off-by: Simon Goldschmidt <sgoldschmidt@de.pepperl-fuchs.com> Acked-by: Maxime Ripard <maxime.ripard@free-electrons.com>
* env: make env_import(_redund) return 0 on success, not 1Simon Goldschmidt2018-01-313-8/+8
| | | | | | | | | | | | | | | | env_import (and env_import_redund) currently return 1 on success and 0 on error. However, they are only used from functions returning 0 on success or a negative value on error. Let's clean this up by making env_import and env_import_redund return 0 on success and -EIO on error (as was the case for all users before). Users that cared for the return value are also updated. Funny enough, this only affects onenand.c and sf.c Signed-off-by: Simon Goldschmidt <sgoldschmidt@de.pepperl-fuchs.com> Acked-by: Maxime Ripard <maxime.ripard@free-electrons.com>
* env: sunxi: Enable FAT-based environment support by defaultMaxime Ripard2018-01-271-0/+4
| | | | | | | | | Now that we have everything in place to implement the transition scheme, let's enable it by default. Reviewed-by: Andre Przywara <andre.przywara@arm.com> Reviewed-by: Lukasz Majewski <lukma@denx.de> Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com>