All of lore.kernel.org
 help / color / mirror / Atom feed
From: Tom Rini <trini@konsulko.com>
To: marty leisner <maleisner@gmail.com>
Cc: u-boot@lists.denx.de
Subject: Re: how u-boot handles the environment (rpi4, fat environment)
Date: Thu, 29 Sep 2022 08:57:14 -0400	[thread overview]
Message-ID: <20220929125714.GY3044094@bill-the-cat> (raw)
In-Reply-To: <CAPNO-hbSH3Veg97PXM9-KbOrqeCUDrnTu5hSAUc=OCcNWy8gdQ@mail.gmail.com>

[-- Attachment #1: Type: text/plain, Size: 1248 bytes --]

On Sun, Sep 25, 2022 at 12:46:10PM -0400, marty leisner wrote:

> I'm running ubuntu 20.04 server (which uses u-boot v2021.01 with minor
> changes/enhancements)
> 
> fw_printenv doesn't seem to work -- it always comes up with a crc error (I
> haven't tried fw_setenv yet).
> 
> Is there a spec of how the environment works?  I haven't seen one.
> 
> Without this patch, I get:
> Warning: Bad CRC, using default environment
> 
> The first environment variable has a "0x1" in front of it.
> When I apply this patch, things seem to work:
> 
> diff --git a/tools/env/fw_env.c b/tools/env/fw_env.c
> index 66cb9d2a..c85b471a 100644
> --- a/tools/env/fw_env.c
> +++ b/tools/env/fw_env.c
> @@ -1457,8 +1457,8 @@ int fw_env_open(struct env_opts *opts)
>                goto open_cleanup;
>        }
> 
> -       crc0 = crc32(0, (uint8_t *)environment.data, ENV_SIZE);
> -
> +       crc0 = crc32(0, (uint8_t *) (environment.data + 1) , ENV_SIZE - 1);
> 
> But I'm not at the phase of doing fw_setenv (I would have used a newer
> u-boot, but I'm getting resets on bootup (it works
> on a vanilla 20.04 system).

Please include your /etc/fw_env.config file and relevant CONFIG_ENV
settings from the U-Boot build.

-- 
Tom

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 659 bytes --]

  reply	other threads:[~2022-09-29 12:57 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-09-25 16:46 how u-boot handles the environment (rpi4, fat environment) marty leisner
2022-09-29 12:57 ` Tom Rini [this message]
2022-10-02 18:38   ` marty leisner

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=20220929125714.GY3044094@bill-the-cat \
    --to=trini@konsulko.com \
    --cc=maleisner@gmail.com \
    --cc=u-boot@lists.denx.de \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.