From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from phobos.denx.de (phobos.denx.de [85.214.62.61]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id C5A3EC07E9D for ; Mon, 26 Sep 2022 11:53:23 +0000 (UTC) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 8A82881E72; Mon, 26 Sep 2022 13:53:21 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="Vrq4/kyu"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 0C73884C0C; Sun, 25 Sep 2022 18:46:53 +0200 (CEST) Received: from mail-lf1-x130.google.com (mail-lf1-x130.google.com [IPv6:2a00:1450:4864:20::130]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id 6D39684BE3 for ; Sun, 25 Sep 2022 18:46:50 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=maleisner@gmail.com Received: by mail-lf1-x130.google.com with SMTP id a2so7481524lfb.6 for ; Sun, 25 Sep 2022 09:46:50 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=to:subject:message-id:date:from:mime-version:from:to:cc:subject :date; bh=KQtxqQDeRFyiqbEw9xHXUzmTOWarMYiCXQezPlbrZg8=; b=Vrq4/kyupDm7SwomoGHTMXzbJrknkqe1iakYnmQxRtnII3YxGngKaCDhNuJL5ie6Mt rkLRyJ4ClHks5DdnMluAe0cbTsPvupJWGQcDHetL6vMZpy7bAWS0lonZq/0VbEj6pOaB 0JjC/TxvjzD0ZQutQglGk3oOGMtOEip1cHr3uusroWJLHvuUj+/S1MbgQIQztd/G8Q1o VAL9F0fxbg8wNWbEqMJwY6Cpd8V/WgFvk1A1eO9nNGfk0jEnEmpzdok/JJC5m71B5pRB XnIwcBszunOc7SxeOKyZM8Fh+rLXtOGJcsY+E+iZEp07KsnVNJi6LBSdADNQVUjyGG7c +zBw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=to:subject:message-id:date:from:mime-version:x-gm-message-state :from:to:cc:subject:date; bh=KQtxqQDeRFyiqbEw9xHXUzmTOWarMYiCXQezPlbrZg8=; b=7fhdtngO+Q9x1DK0VMa4hff6dCPv15VMD+pEVw66KJbSKHtW6HWipdm1WuaGLF43bo IwJe3Hc4jrgzR7G5tUQxs6jXEcXUUR/Na2DLDTggZa7tp9stImTuQijQmaE9tM9ZOA0c zdeiU7/xqyQZp7GYoWQuBm4vzS8Qgk0u5DlRrsbX6aYEBQhBl2ap/zLUgOl+amQGw1La LQz43qccFXj//iGx2SmiZuhj28rzH8f8Ki7dPjX6Ljc3MSIISCn5FDbWjSErtnrXZV7u lmQk3nofeBR0Fdp7YNj960zoeCedPH7zyXYjuwG2f6qvUZFzgY+0PVsOIdQubTMSfIqL uaPw== X-Gm-Message-State: ACrzQf2ON5svoN7yu7C/01SDSsULH34hovVbnr0CkVH+3gYR7GKFx6km Q0lLeV+a59ed1z2g5vMan63LhefjTex2P6OwiaM+KOR7xqVIS5s= X-Google-Smtp-Source: AMsMyM5BlOuZQZcfxOHlXpwPTBnCK2PrzYCIcgcMz0K7QDhyYuka38Qaxkr253wrSUEih4oF6yKU0n26rRvQexvlUlk= X-Received: by 2002:a19:e01e:0:b0:497:81a9:c2c4 with SMTP id x30-20020a19e01e000000b0049781a9c2c4mr7248117lfg.74.1664124407882; Sun, 25 Sep 2022 09:46:47 -0700 (PDT) MIME-Version: 1.0 From: marty leisner Date: Sun, 25 Sep 2022 12:46:10 -0400 Message-ID: Subject: how u-boot handles the environment (rpi4, fat environment) To: u-boot@lists.denx.de X-Mailman-Approved-At: Mon, 26 Sep 2022 13:53:20 +0200 Content-Type: text/plain; charset="UTF-8" X-Content-Filtered-By: Mailman/MimeDel 2.1.39 X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.39 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" X-Virus-Scanned: clamav-milter 0.103.6 at phobos.denx.de X-Virus-Status: Clean 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). marty marty