Hi Friedrich, On Thu, 7 Nov 2024 at 14:53, Friedrich Doku <[email protected]> wrote: > > Hi, > > I hope this email finds you well. I am currently working on a project > involving U-Boot, and I have a question regarding memory management. > Specifically, I would like to understand the best approach to zero all > memory that is not currently in use. > > I am considering using memset to achieve this, but I am unsure about the > most efficient and safe way to determine which regions of memory are not in > use and can be safely zeroed out. Could you please provide guidance on: > > 1. Identifying unused memory regions in U-Boot during runtime. > 2. Using memset or any other recommended method to zero these regions > without interfering with critical data structures or operational stability. > 3. Any potential risks or best practices I should be aware of when > performing such operations in U-Boot. > > I would greatly appreciate any insights, examples, or documentation you > could share on this topic. Thank you for your time and for all the > incredible work you do to maintain and enhance U-Boot. > > Looking forward to your response.
After relocation, before images are loaded, you can zero from the start of memory to the bottom of the U-Boot stack. The 'meminfo' command[1] shows this mapping. Unfortunately a recent change has make the EFI_LOADER use memory outside the U-Boot region. I am still hoping we can correct this design error before it causes too many problems. For now you can disable CONFIG_EFI_LOADER to avoid this, so long as you don't need to load/run EFI apps. Regards, Simon [1] https://docs.u-boot.org/en/latest/usage/cmd/meminfo.html

