All of lore.kernel.org
 help / color / mirror / Atom feed
From: bugzilla at busybox.net <bugzilla@busybox.net>
To: buildroot@busybox.net
Subject: [Buildroot] [Bug 10426] New: uboot-tools' fw_setenv does not update the redundant environment
Date: Fri, 20 Oct 2017 16:17:08 +0000	[thread overview]
Message-ID: <bug-10426-163@https.bugs.busybox.net/> (raw)

https://bugs.busybox.net/show_bug.cgi?id=10426

            Bug ID: 10426
           Summary: uboot-tools' fw_setenv does not update the redundant
                    environment
           Product: buildroot
           Version: unspecified
          Hardware: All
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P5
         Component: Other
          Assignee: unassigned at buildroot.uclibc.org
          Reporter: jan.kundrat at cesnet.cz
                CC: buildroot at uclibc.org
  Target Milestone: ---

U-Boot supports two redundant copies of its environment as an optional feature.
This is typically configured in board-specific include/configs/foo-board-name.h
files. It seems that users are free to choose where to put these copies, and
there's no standard for this as far as I can tell.

Buildroot currently does not attempt to keep the real U-Boot's config and
uboot-tools' config in sync. In fact, there's no effort to keep their versions
synced, and probably for a good reason (one might not want to update the
bootloader, for example). Buildroot also attempts to patch out a dependency on
a "config.h" for uboot-tools
(package/uboot-tools/0001-drop-configh-from-tools.patch). Apparently, the idea
is to rely on a properly configured /etc/fw_env.config for env offsets, etc.

This is a problem because fw_putenv does not know that a redundant environment
is in use, and it only writes one copy. I checked with strace; fw_printenv
reads both copies, but then it only stores the primary one:

open("/etc/fw_env.config", O_RDONLY)    = 4
fstat64(4, {st_mode=S_IFREG|0644, st_size=70, ...}) = 0
read(4, "/dev/mmcblk0 0xf0000 0x10000 0x2"..., 4096) = 70
close(4)                                = 0
open("/dev/mmcblk0", O_RDONLY)          = 4
fstat64(4, {st_mode=S_IFBLK|0660, st_rdev=makedev(179, 0), ...}) = 0
close(4)                                = 0
open("/dev/mmcblk0", O_RDONLY)          = 4
fstat64(4, {st_mode=S_IFBLK|0660, st_rdev=makedev(179, 0), ...}) = 0
close(4)                                = 0
open("/dev/mmcblk0", O_RDONLY)          = 4
lseek(4, 983040, SEEK_SET)              = 983040
read(4, "\32\224!\324\"BOOT_A_LEFT=3\0BOOT_B_LEFT=2"..., 65536) = 65536     
<---- this is the primary copy
close(4)                                = 0
brk(0x69000)                            = 0x69000
open("/dev/mmcblk0", O_RDONLY)          = 4
lseek(4, 917504, SEEK_SET)              = 917504
read(4, "\226\37\326:#BOOT_A_LEFT=3\0BOOT_ORDER=B "..., 65536) = 65536      
<---- secondary environment
close(4)                                = 0
open("/dev/mmcblk0", O_RDWR)            = 4
open("/dev/mmcblk0", O_RDWR)            = 5
lseek(5, 983040, SEEK_SET)              = 983040
write(5, "Sgm[$BOOT_A_LEFT=3\0BOOT_ORDER=B "..., 65536) = 65536             
<---- this is the primary's address
close(5)                                = 0
close(4)                                = 0
brk(0x49000)                            = 0x49000
flock(3, LOCK_UN)                       = 0
close(3)                                = 0
exit_group(0)                           = ?
+++ exited with 0 +++

-- 
You are receiving this mail because:
You are on the CC list for the bug.

             reply	other threads:[~2017-10-20 16:17 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-10-20 16:17 bugzilla at busybox.net [this message]
2017-10-20 16:30 ` [Buildroot] [Bug 10426] uboot-tools' fw_setenv does not update the redundant environment bugzilla at busybox.net
2017-10-20 16:43 ` bugzilla at busybox.net
2017-10-20 17:16 ` bugzilla at busybox.net

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=bug-10426-163@https.bugs.busybox.net/ \
    --to=bugzilla@busybox.net \
    --cc=buildroot@busybox.net \
    /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.