yocto.lists.yoctoproject.org archive mirror
 help / color / mirror / Atom feed
From: Vipin Vijayan <vipin.v@calixto.co.in>
To: yocto@lists.yoctoproject.org
Subject: libubootenv setup
Date: Sat, 3 Jun 2023 15:59:25 +0530	[thread overview]
Message-ID: <CAPDLeY0fo=4OQYXRnmK1rcqO_QMEWhLEEx6_exUHnRMH7mjsTg@mail.gmail.com> (raw)


[-- Attachment #1.1: Type: text/plain, Size: 1405 bytes --]

Hi,
I am working on our custom board with dunfell version and we are using a
custom u-boot for the board. But when i try to use fw_printenv and
fw_setenv iam not being able to access those functionalities. Iam using
libubootenv for those specific functionalities .

iam adding libubootenv-bin in image_install and iam getting the fw_printenv
and fw_setenv in the /usr/bin folder

But when i use fw_printenv and fw_setenv iam getting an error,
Can't read from default
Can't read from file.

We are storing the environment variables in the spi flash /dev/mtd3

When i try hexdump i can find the variables present
But iam not being able to access it with fw_printenv and fw_setenv any
variable using fw_setenv

I should mention that fw_env.config is perfect and does not have any error
in it, because when we try to access those variables using another
fw_printenv, which we got from executing make in the git source , we are
getting the variables printed.

Also during build of the u-boot we are using a patch file which we got from
internet for its build succession, I dont know whether that patch
interferes with anything that hinders its function.

Iam attaching my fw_env.config and also the patch file i used for u-boot
along with this

As iam a beginner in this field, Iam not much aware of these
functionalities in detail. Please look in to the issue and any helps are
appreciated.

Regards,
*Vipin*

[-- Attachment #1.2: Type: text/html, Size: 1843 bytes --]

[-- Attachment #2: fw_env.config --]
[-- Type: application/xml, Size: 1359 bytes --]

[-- Attachment #3: test.patch --]
[-- Type: application/octet-stream, Size: 1605 bytes --]

From bdaa73a5b3923257add182b4ab8058dbfa33421b Mon Sep 17 00:00:00 2001
From: Stefano Babic <sbabic@denx.de>
Date: Wed, 13 Mar 2019 09:46:45 +0100
Subject: [PATCH] Add target to generate initial environment

The initial environment is linked to the u-boot binary. Modifying the
environment from User Space with the env tools requires that the tools
are always built together with the bootloader to be sure that they
contain the initial environment in case no environment is stored into
persistent storage or when a board boots with just the default
environment. This makes difficult for distros to provide a general
package to access the environment. A simpler way is if the tools are
generic for all boards and a configuration file is given to provide the
initial environment.

The patch just generates the initial environment by extracting it from
the compiled object. This file can then be used for tools in user space
to initialize the environment.

Signed-off-by: Stefano Babic <sbabic@denx.de>
---
 Makefile | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/Makefile b/Makefile
index 66a09ac900c3..f2c7bb6041a2 100644
--- a/Makefile
+++ b/Makefile
@@ -1977,6 +1977,13 @@ endif
 	$(build)=$(build-dir) $(@:.ko=.o)
 	$(Q)$(MAKE) -f $(srctree)/scripts/Makefile.modpost
 
+quiet_cmd_genenv = GENENV $@
+cmd_genenv = $(OBJCOPY) --dump-section .rodata.default_environment=$@ env/common.o; \
+	sed --in-place -e 's/\x00/\x0A/g' $@
+
+u-boot-initial-env: u-boot.bin
+	$(call if_changed,genenv)
+
 # Consistency checks
 # ---------------------------------------------------------------------------
 

             reply	other threads:[~2023-06-03 10:29 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-06-03 10:29 Vipin Vijayan [this message]
2023-06-03 12:07 ` [yocto] libubootenv setup Stefano Babic

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='CAPDLeY0fo=4OQYXRnmK1rcqO_QMEWhLEEx6_exUHnRMH7mjsTg@mail.gmail.com' \
    --to=vipin.v@calixto.co.in \
    --cc=yocto@lists.yoctoproject.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).