summaryrefslogtreecommitdiff
path: root/env
AgeCommit message (Collapse)AuthorFilesLines
2024-08-08ubi: allow to write to volume with offsetAlexey Romanov1-5/+5
Introduce ubi_volume_offset_write() helper, which allow to write to ubi volume with specified offset. Signed-off-by: Alexey Romanov <avromanov@salutedevices.com> Reviewed-by: Heiko Schocher <hs@denx.de> Acked-by: Heiko Schocher <hs@denx.de> Signed-off-by: Michael Trimarchi <michael@amarulasolutions.com>
2024-08-08ubi: allow to read from volume with offsetAlexey Romanov1-3/+3
Now user can pass an additional parameter 'offset' to ubi_volume_read() function. Signed-off-by: Alexey Romanov <avromanov@salutedevices.com> Reviewed-by: Heiko Schocher <hs@denx.de> Acked-by: Heiko Schocher <hs@denx.de> Signed-off-by: Michael Trimarchi <michael@amarulasolutions.com>
2024-08-05env_spi: support overriding spi dev from board codeVenkatesh Yadav Abbarapu1-1/+11
This enables boards to choose where to/from the environment should be saved/loaded. They can then for example support using the same device (dynamically) from which the bootloader was launched to load and save env data and do not have to define CONFIG_ENV_SPI_BUS statically. In my use case, the environment needs to be on the same device I booted from. It can be the QSPI or OSPI device. I therefore would override spi_get_env_dev in the board code, read the bootmode registers to determine where we booted from and return the corresponding device index. Signed-off-by: Venkatesh Yadav Abbarapu <venkatesh.abbarapu@amd.com> Link: https://lore.kernel.org/r/20240614124811.22945-2-venkatesh.abbarapu@amd.com Signed-off-by: Michal Simek <michal.simek@amd.com> # Move spi_get_env_dev to sf.c
2024-07-31env: mmc: Fix env loading with CONFIG_SYS_MMC_ENV_PARTMattijs Korpershoek1-2/+3
When CONFIG_SYS_MMC_ENV_PART=2, the environment is loaded from the USER partition (hwpart=0) instead of from the BOOT1 partition (hwpart=2). IS_ENABLED() cannot be used for non-boolean KConfig options. Its documentation states: > * IS_ENABLED(CONFIG_FOO) evaluates to 1 if CONFIG_FOO is set to 'y', > * 0 otherwise. So in our case, IS_ENABLED(CONFIG_SYS_MMC_ENV_PART) evaluates to 0. Because of this, the hwpart variable is never assigned and mmc_offset() ends up switching back to the USER hwpart (0) instead of BOOT1 (2). Fix it by using #define instead. Tested with: # have CONFIG_SYS_MMC_ENV_PART=2 in defconfig # 1. Erase mmc0boot1 => mmc dev 0 2 => mmc erase 0 400 => mmc read ${loadaddr} 0 400 => md ${loadaddr} 4 82000000: 00000000 00000000 00000000 00000000 ................ # 2. Restore default environment and save to MMC => env default -a -f => saveenv # 3. Read back mmc0boot1 and confirm the env is present => mmc read ${loadaddr} 0 400 => md ${loadaddr} 4 82000000: 13e0632e 72646461 7469665f 3978303d .c..addr_fit=0x9 Fixes: 5b4acb0ff79d ("env: mmc: Apply GPT only on eMMC user HW partition") Signed-off-by: Mattijs Korpershoek <mkorpershoek@baylibre.com> Reviewed-by: Tom Rini <trini@konsulko.com>
2024-07-15Merge patch series "api: Remove duplicate newlines"Tom Rini1-2/+0
This removes a number of duplicate newlines throughout the codebase.
2024-07-15env: Remove duplicate newlinesMarek Vasut1-2/+0
Drop all duplicate newlines. No functional change. Signed-off-by: Marek Vasut <marek.vasut+renesas@mailbox.org>
2024-07-14env: ENV_IS_IN_EXT4 should enable SYS_MMC_ENV_DEVHeinrich Schuchardt1-1/+1
When enabling CONFIG_ENV_IS_IN_EXT4 the environment might be stored on an mmc device similar to the CONFIG_ENV_IS_IN_FAT case. Fixes: 7d080773347c ("Convert CONFIG_SYS_MMC_ENV_DEV et al to Kconfig") Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
2024-06-17arm64: versal2: Add support for AMD Versal Gen 2Michal Simek1-3/+3
Add support for AMD Versal Gen 2. SoC is based on Cortex-a78ae 4 cluster/2 cpu core each. A lot of IPs are shared with previous families. There are couple of new IP blocks where the most interesting from user point of view is UFS. Signed-off-by: Michal Simek <michal.simek@amd.com> Link: https://lore.kernel.org/r/bc2b70831ce1031bd0fac32357bff84936e1310f.1716994063.git.michal.simek@amd.com
2024-05-20Restore patch series "arm: dts: am62-beagleplay: Fix Beagleplay Ethernet"Tom Rini18-20/+7
As part of bringing the master branch back in to next, we need to allow for all of these changes to exist here. Reported-by: Jonas Karlman <jonas@kwiboo.se> Signed-off-by: Tom Rini <trini@konsulko.com>
2024-05-19Revert "Merge patch series "arm: dts: am62-beagleplay: Fix Beagleplay Ethernet""Tom Rini18-7/+20
When bringing in the series 'arm: dts: am62-beagleplay: Fix Beagleplay Ethernet"' I failed to notice that b4 noticed it was based on next and so took that as the base commit and merged that part of next to master. This reverts commit c8ffd1356d42223cbb8c86280a083cc3c93e6426, reversing changes made to 2ee6f3a5f7550de3599faef9704e166e5dcace35. Reported-by: Jonas Karlman <jonas@kwiboo.se> Signed-off-by: Tom Rini <trini@konsulko.com>
2024-05-17Init virtio before loading ENV from EXT4 or FATFiona Klute2-0/+10
Specifying a file in an EXT4 or FAT partition on a virtio device as environment location failed because virtio hadn't been initialized by the time the environment was loaded. This patch mirrors commit 54ee5ae84191 ("Add SCSI scan for ENV in EXT4 or FAT") in issue and fix, just for a different kind of block device. The additional include in include/virtio.h is needed so all functions called there are defined, the alternative would have been to include dm/device.h separately in the env/ sources. Checkpatch suggests using "if (IS_ENABLED(CONFIG...))" instead of "#if defined(CONFIG_...)", I'm sticking to the style of the existing code here. Signed-off-by: Fiona Klute <fiona.klute@gmx.de> CC: Joe Hershberger <joe.hershberger@ni.com> CC: Bin Meng <bmeng.cn@gmail.com> CC: Rogier Stam <rogier@unrailed.org>
2024-05-06env: Remove <common.h> and add needed includesTom Rini17-19/+6
Remove <common.h> from all "env/" files and when needed add missing include files directly. Signed-off-by: Tom Rini <trini@konsulko.com>
2024-05-06cmd/Kconfig: Add some missing dependenciesTom Rini1-1/+1
With the migration to Kconfig complete, we can now add some previously missing dependencies to some commands. Signed-off-by: Tom Rini <trini@konsulko.com>
2024-04-18env: mmc: print MMC device being readQuentin Schulz1-0/+3
This prints the MMC device being read similar to how we print the MMC device we write to when e.g. calling saveenv. One of the side effects is that the boot log now shows from which MMC device the env was loaded: Loading Environment from MMC... Reading from MMC(1)... OK This is useful to identify which MMC device the environment was loaded from for boards where there are more than one (e.g. eMMC and SD card) without adding some debug messages manually. Sadly, there's no way to know which of the default or redundant environment is being read from env_mmc_load before env_import_redund is called so it is printing a bit later (and possibly after error/warning messages). Cc: Quentin Schulz <foss+uboot@0leil.net> Signed-off-by: Quentin Schulz <quentin.schulz@theobroma-systems.com> Reviewed-by: Tom Rini <trini@konsulko.com> Reviewed-by: Dragan Simic <dsimic@manjaro.org>
2024-03-22xilinx: versal-net: Add support for saving env based on bootmodeVenkatesh Yadav Abbarapu1-1/+1
Enable saving variables to MMC(FAT) and SPI based on primary bootmode. If bootmode is JTAG, dont save env anywhere(NOWHERE). Enable ENV_FAT_DEVICE_AND_PART="0:auto" for versal-net platform as well. Signed-off-by: Venkatesh Yadav Abbarapu <venkatesh.abbarapu@amd.com> Link: https://lore.kernel.org/r/20240312113421.7394-1-venkatesh.abbarapu@amd.com Signed-off-by: Michal Simek <michal.simek@amd.com>
2024-01-29env: sf: report malloc error to callerRalph Siemsen1-1/+3
In the non-redundant code for env_sf_save(), a failure to malloc() the temporary buffer produces the following output: Saving Environment to SPIFlash... OK This is misleading as the flash has neither been erased nor written. Fix it to return an error to the caller, so the output will be: Saving Environment to SPIFlash... Failed (-12) Note that there is another copy of env_sf_save() in the same file, for handling redundant environment, and it already has the same logic. Signed-off-by: Ralph Siemsen <ralph.siemsen@linaro.org>
2024-01-22env: Make ENV_IS_IN_SPI_FLASH depend on SPI flash being presentTom Rini1-1/+1
In order for our environment to be present on SPI flash we need to depend not on the symbol for a SPI controller but rather that SPI flash of some sort is present. Update the dependencies. Signed-off-by: Tom Rini <trini@konsulko.com>
2024-01-19Merge branch '2024-01-18-assorted-fixes'Tom Rini1-1/+1
- A number of OS boot related cleanups, a number of TI platform fixes/cleanups, SMBIOS fixes, tweak get_maintainers.pl to report me for more places, fix the "clean the build" pytest and add a bootstage pytest, fix PKCS11 URI being omitted in some valid cases, make an iommu problem easier to debug on new platforms, nvme and pci improvements, refactor image-host code a bit, fix a typo in env setting, add a missing dependency for CMD_LICENSE, and correct how we call getchar() in some places.
2024-01-19env: migrate env_get_default to call env_get_default_intoQuentin Schulz1-3/+5
Since both functions share a similar goal and env_get_default_into can do what env_get_default wants to do with specific arguments, let's make env_get_default call env_get_default_into so as to avoid code duplication. Cc: Quentin Schulz <foss+uboot@0leil.net> Reviewed-by: Tom Rini <trini@konsulko.com> Reviewed-by: Kever Yang <kever.yang@rock-chips.com> Signed-off-by: Quentin Schulz <quentin.schulz@theobroma-systems.com>
2024-01-19env: allow to copy value from default environment into a bufferQuentin Schulz1-0/+8
env_get_default suffers from a particular issue int that it can only return a value truncated to gd->env_buf (32) characters. This may be enough for most variables but it isn't for others, so let's allow users to provide a preallocated buffer to copy the value into instead, allowing for more control, though it'll still be truncated if the value size is bigger than the preallocated buffer. Cc: Quentin Schulz <foss+uboot@0leil.net> Reviewed-by: Tom Rini <trini@konsulko.com> Reviewed-by: Kever Yang <kever.yang@rock-chips.com> Signed-off-by: Quentin Schulz <quentin.schulz@theobroma-systems.com>
2024-01-18cmd: nvedit: Fix typo in 'illegal character' errorIvan Orlov1-1/+1
Fix a typo: add a space after the single quote in 'illegal character' error message in 'env set' command Signed-off-by: Ivan Orlov <ivan.orlov@codethink.co.uk>
2023-12-21global: Restrict use of '#include <linux/kconfig.h>'Tom Rini1-0/+2
In general terms, we -include include/linux/kconfig.h and so normal U-Boot code does not need to also #include it. However, for code which is shared with userspace we may need to add it so that either our full config is available or so that macros such as CONFIG_IS_ENABLED() can be evaluated. In this case make sure that we guard these includes with a test for USE_HOSTCC so that it clear as to why we're doing this. Reviewed-by: Simon Glass <sjg@chromium.org> Signed-off-by: Tom Rini <trini@konsulko.com>
2023-12-13Merge patch series "bootm: Refactoring to reduce reliance on CMDLINE (part A)"Tom Rini1-1/+1
To quote the author: It would be useful to be able to boot an OS when CONFIG_CMDLINE is disabled. This could allow reduced code size. Standard boot provides a way to handle programmatic boot, without scripts, so such a feature is possible. The main impediment is the inability to use the booting features of U-Boot without a command line. So the solution is to avoid passing command arguments and the like to code in boot/ A similar process has taken place with filesystems, for example, where we have (somewhat) separate Kconfig options for the filesystem commands and the filesystems themselves. This series starts the process of refactoring the bootm logic so that it can be called from standard boot without using the command line. Mostly it removes the use of argc, argv and cmdtbl from the internal logic. Some limited tidy-up is included, but this is kept to smaller patches, rather than trying to remove all #ifdefs etc. Some function comments are added, however. A simple programmatic boot is provided as a starting point. This work will likely take many series, so this is just the start. Size growth with this series for firefly-rk3288 (Thumb2) is: arm: (for 1/1 boards) all +23.0 rodata -49.0 text +72.0 This should be removed by: https://source.denx.de/u-boot/custodians/u-boot-dm/-/issues/11 but it is not included in this series as it is already large enough. No functional change is intended in this series. Changes in v3: - Add a panic if programmatic boot fails - Drop RFC tag Changes in v2: - Add new patch to adjust position of unmap_sysmem() in boot_get_kernel() - Add new patch to obtain command arguments - Fix 'boot_find_os' typo - Pass in the command name - Use the command table to provide the command name, instead of "bootm"
2023-12-13mmc: env: Unify the U_BOOT_ENV_LOCATION conditionsSimon Glass1-1/+1
The declaration of U_BOOT_ENV_LOCATION() uses a different #ifdef condition from the code it calls. Use the same condition to avoid a build warning if CONFIG_CMD_SAVEENV is disabled. Signed-off-by: Simon Glass <sjg@chromium.org> Reviewed-by: Tom Rini <trini@konsulko.com> Reviewed-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
2023-11-16fs: ext4: Remove unused parameter from ext4_mountSean Anderson1-2/+2
The part_length parameter is not used. Remove it. Signed-off-by: Sean Anderson <seanga2@gmail.com>
2023-11-07env: Move env_set() out of cmd/nvedit.c and in to env/common.cTom Rini1-4/+109
Inside of env/common.c we already have our helper env_set_xxx functions, and even have a comment that explains why env_set() itself wasn't moved. We now handle that move. This requires that we rename the previous _do_env_set() to env_do_env_set() and note it as an internal env function. Add comments about this function to explain why we do this when we add the prototype. Add a new function, env_inc_id() to allow for the counter to be updated by both commands and callers, and document this as well by the prototype. Signed-off-by: Tom Rini <trini@konsulko.com>
2023-10-11env: Improve ENV_OFFSET help messagePaul Barker1-1/+11
When reading Kconfig help messages to understand ENV_OFFSET and ENV_OFFSET_REDUND, developers may not realise that they need to also look at the chosen ENV_IS_IN_* options to see how the offsets will be interpreted. Signed-off-by: Paul Barker <paul.barker.ct@bp.renesas.com> Reviewed-by: Simon Glass <sjg@chromium.org>
2023-10-10fsl-layerscape: drop obsolete PPA secure firmware supportLaurentiu Tudor1-1/+1
PPA was a secure firmware developed in-house which is no longer supported and replaced by TF-A quite some years ago. Drop support for it. Signed-off-by: Laurentiu Tudor <laurentiu.tudor@nxp.com> Signed-off-by: Peng Fan <peng.fan@nxp.com>
2023-09-24common: Drop linux/printk.h from common headerSimon Glass1-0/+1
This old patch was marked as deferred. Bring it back to life, to continue towards the removal of common.h Move this out of the common header and include it only where needed. Signed-off-by: Simon Glass <sjg@chromium.org>
2023-09-14env: Remove unused NEEDS_MANUAL_RELOC code bitsMarek Vasut3-39/+0
The last user of the NEEDS_MANUAL_RELOC has been removed in commit 26af162ac8f8 ("arch: m68k: Implement relocation") Remove now unused NEEDS_MANUAL_RELOC code. Signed-off-by: Marek Vasut <marek.vasut+renesas@mailbox.org>
2023-09-14cmd: nvedit: Remove unused NEEDS_MANUAL_RELOC code bitsMarek Vasut1-1/+0
The last user of the NEEDS_MANUAL_RELOC has been removed in commit 26af162ac8f8 ("arch: m68k: Implement relocation") Remove now unused NEEDS_MANUAL_RELOC code. Signed-off-by: Marek Vasut <marek.vasut+renesas@mailbox.org>
2023-08-09Kconfigs: Correct default of "0" on hex type entriesTom Rini1-2/+2
It is not a parse error to have a default value of "0" for a "hex" type entry, instead of "0x0". However, "0" and "0x0" are not treated the same even by the tools themselves. Correct this by changing the default value from "0" to "0x0" for all hex type questions that had the incorrect default. Fix one instance (in two configs) of a default of "0" being used on a hex question to be "0x0". Remove the cases where a defconfig had set a value of "0x0" to be used as the default had been "0". Signed-off-by: Tom Rini <trini@konsulko.com> Reviewed-by: Simon Glass <sjg@chromium.org>
2023-07-17env: Fix default environment saving issueAshok Reddy Soma1-0/+1
When CONFIG_SYS_REDUNDAND_ENVIRONMENT is enabled, by default env is getting saved to redundant environment irrespective of primary env is present or not. It means even if primary and redundant environment are not present, by default, env is getting stored to redundant environment. Even if primary env is present, it is choosing to store in redudndant env. Ideally it should look for primary env and choose to store in primary env if it is present. If both primary and redundant env are not present then it should save in to primary env area. Fix the issue by making env_valid = ENV_INVALID when both the environments are not present. Signed-off-by: Ashok Reddy Soma <ashok.reddy.soma@amd.com> Reviewed-by: Simon Glass <sjg@chromium.org>
2023-07-14env: mmc: statically set the environment partition nameEmmanuel Di Fede2-0/+17
The new opt-out setting, CONFIG_ENV_MMC_PARTITION, statically sets the MMC environment partition name. Prior to this patch, the only way to declare this partition name was by creating a 'u-boot,mmc-env-partition' parameter in the device-tree's /config node. This setting provides additional flexibility, particularly in cases where accessing the device-tree is not straightforward (e.g. QEMU). If undeclared, the device-tree's setting will be used. Signed-off-by: Emmanuel Di Fede <emmanuel.difede@cysec.com> Cc: Joe Hershberger <joe.hershberger@ni.com> Cc: Patrick Delaunay <patrick.delaunay@foss.st.com>
2023-05-16env: Remove misuse of env is nowhere leftoverStefan Herbrechtsmeier1-2/+0
When using a list of writeable variables, the initial values come from the built-in default environment since commit 5ab81058364b ("env: Complete generic support for writable list"). Remove leftover of misuse of the env is nowhere driver as default environment. Signed-off-by: Stefan Herbrechtsmeier <stefan.herbrechtsmeier@weidmueller.com>
2023-05-09cmd: nvedit: remove error check, handle with KconfigTroy Kisky1-7/+10
Avoid error messages when SPL,TPL,VPL build don't have the environment options of the main build. This is needed when defined(CONFIG_ENV_IS_IN_xxx) is changed to CONFIG_IS_ENABLED(ENV_IS_IN_xxx). Signed-off-by: Troy Kisky <troykiskyboundary@gmail.com>
2023-03-02env: Allow VPL environment to be nowhereSimon Glass1-0/+10
Add an option to put the VPL environment nowhere (not in storage). Signed-off-by: Simon Glass <sjg@chromium.org>
2023-02-23env: mmc: Apply GPT only on eMMC user HW partitionMarek Vasut1-4/+8
Apply the GPT U-Boot environment GUID type look up only on eMMC user HW partition, do not apply the look up on eMMC boot HW partitions as mmc_offset_try_partition() assumes either SD partitions or eMMC user HW partition. This fixes environment operation on systems where CONFIG_SYS_MMC_ENV_PART is non-zero and CONFIG_SYS_REDUNDAND_ENVIRONMENT is set. Fixes: 80105d8fd52 ("env: mmc: select GPT env partition by type guid") Signed-off-by: Marek Vasut <marex@denx.de> Reviewed-by: Tom Rini <trini@konsulko.com>
2023-02-10env: Couple networking-related variable flags to CONFIG_NETJan Kiszka1-5/+5
Boards may set networking variables programmatically, thus may have CONFIG_NET on but CONFIG_CMD_NET off. The IOT2050 is an example. CC: Joe Hershberger <joe.hershberger@ni.com> Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com> Reviewed-by: Tom Rini <trini@konsulko.com>
2023-02-10env: Complete generic support for writable listJan Kiszka2-0/+9
This completes what 890feecaab72 started by selecting ENV_APPEND and loading the default env before any other sources. This ensures that load operations pick up all non-writable vars from the default env and only permitted parts from other locations according to the regular priorities. With this change, boards only need to define the list of writable variables but no longer have to provide a custom env_get_location implementation. CC: Joe Hershberger <joe.hershberger@ni.com> CC: Marek Vasut <marex@denx.de> CC: Stefan Herbrechtsmeier <stefan.herbrechtsmeier-oss@weidmueller.com> Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com> Reviewed-by: Marek Vasut <marex@denx.de>
2023-02-07env: Drop ENV_IS_IN_SATASimon Glass3-126/+0
This is not used anywhere, so drop it. Signed-off-by: Simon Glass <sjg@chromium.org>
2023-02-06env: mmc: Fix offset issue for env saveYe Li1-4/+4
Fix the issue in commit 46c9016 ("env: mcc: Drop unnecessary #ifdefs") If CONFIG_SYS_REDUNDAND_ENVIRONMENT is not defined, the offset value becomes undetermined, so write env to unexpected offset. Signed-off-by: Ye Li <ye.li@nxp.com> Reviewed-by: Jaehoon Chung <jh80.chung@samsung.com>
2023-01-11env: add failing trace in env_erasePatrick Delaunay1-2/+6
Add trace in env save to indicate any errors to end user and avoid silent output when the command 'env erase' is not executed as it is done in env_save with commit 8968288cb477 ("env: add failing trace in env_save") Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com> Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com> Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com> Reviewed-by: Heiko Schocher <hs@denx.de>
2023-01-11env: ubi: add support of command env erasePatrick Delaunay1-0/+40
Add support of opts erase for ubi env backend, this opts is used by command 'env erase'. This command only zero-fill the env UBI volume CONFIG_ENV_UBI_VOLUME and CONFIG_ENV_UBI_VOLUME_REDUND, so the saved environment becomes invalid. This patch introduces a local define ENV_UBI_VOLUME_REDUND only to avoid #if in the code, as CONFIG_ENV_UBI_VOLUME_REDUND is only defined when CONFIG_SYS_REDUNDAND_ENVIRONMENT is defined. Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com> Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com> Reviewed-by: Heiko Schocher <hs@denx.de>
2023-01-10env: mmc: cosmetic: remove unused macro STR(X)Patrick Delaunay1-3/+0
Remove the unused macro STR(X) since the commit 2b2f727500dc ("env: mmc: allow support of mmc_get_env_dev with OF_CONTROL") Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com> Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>
2023-01-10env: mmc: add debug message when mmc-env-partition is not foundPatrick Delaunay1-0/+1
Add a debug message to indicate a potential issue when "u-boot,mmc-env-partition" is present in config node of device tree but this partition name is not found in the mmc device. Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com> Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>
2023-01-10env: mmc: select GPT env partition by type guidPatrick Delaunay1-1/+18
Since commit c0364ce1c695 ("doc/README.gpt: define partition type GUID for U-Boot environment"), a specific type GUID can be used to indicate the U-Boot environment partition on the device with GPT partition table. This patch uses this type GUID to found the env partition as fallback when the partition name property "u-boot,mmc-env-partition" is not present in config node or if the indicated partition name is not found. The mmc_offset_try_partition() function is reused, it selects the first partition with the correct type GUID when the parameter 'str' is NULL. Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com> Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>
2023-01-10env: mmc: add CONFIG_ENV_MMC_USE_DTPatrick Delaunay2-0/+23
Add a new config CONFIG_ENV_MMC_USE_DT to force configuration of the U-Boot environment offset with device tree config node. This patch avoids issues when several CONFIG_ENV_IS_IN_XXX are activated, the defconfig file uses the same value for CONFIG_ENV_OFFSET or CONFIG_ENV_OFFSET_REDUND for the several ENV backends (SPI_FLASH, EEPROM NAND, SATA, MMC). After this patch a bad offset value is not possible when the selected partition in device tree is not found. Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com> Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>
2023-01-10env: mcc: fix compilation error with ENV_IS_EMBEDDEDPatrick Delaunay1-5/+7
When ENV_IS_EMBEDDED is enabled, ret is not defined but is used as a return value in env_mmc_load(). This patch correct this issue and simplify the existing code, test only one time #if defined(ENV_IS_EMBEDDED) and not in the function. Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com> Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>
2023-01-10env: mcc: Drop unnecessary #ifdefsPatrick Delaunay1-56/+64
This file has a lot of conditional code and much of it is unnecessary. Clean this up to reduce the number of build combinations. This patch replaces the test on CONFIG_ENV_OFFSET_REDUND for the more coherent CONFIG_SYS_REDUNDAND_ENVIRONMENT. This patch also corrects a compilation issue in init_mmc_for_env() when CONFIG_SYS_MMC_ENV_PART is not activated, env_mmc_orig_hwpart is not defined. Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com> Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>