Skip to content
Snippets Groups Projects
  1. Apr 25, 2022
    • Tom Rini's avatar
      nds32: Remove the architecture · 11232139
      Tom Rini authored
      
      As removal of nds32 has been ack'd for the Linux kernel, remove support
      here as well.
      
      Cc: Rick Chen <rick@andestech.com>
      Signed-off-by: default avatarTom Rini <trini@konsulko.com>
      Reviewed-by: Rick Chen's avatarRick Chen <rick@andestech.com>
      11232139
    • Tom Rini's avatar
      Merge branch '2022-04-25-initial-implementation-of-stdboot' · 8cfac237
      Tom Rini authored
      To quote the author:
      The bootflow feature provide a built-in way for U-Boot to automatically
      boot an Operating System without custom scripting and other customisation.
      This is called 'standard boot' since it provides a standard way for
      U-Boot to boot a distro, without scripting.
      
      It introduces the following concepts:
      
         - bootdev - a device which can hold a distro
         - bootmeth - a method to scan a bootdev to find bootflows (owned by
                      U-Boot)
         - bootflow - a description of how to boot (owned by the distro)
      
      This series provides an implementation of these, enabled to scan for
      bootflows from MMC, USB and Ethernet. It supports the existing distro
      boot as well as the EFI loader flow (bootefi/bootmgr). It works
      similiarly to the existing script-based approach, but is native to
      U-Boot.
      
      With this we can boot on a Raspberry Pi 3 with just one command:
      
         bootflow scan -lb
      
      which means to scan, listing (-l) each bootflow and trying to boot each
      one (-b). The final patch shows this.
      
      With a standard way to identify boot devices, booting become easier. It
      also should be possible to support U-Boot scripts, for backwards
      compatibility only.
      
      ...
      
      The design is described in these two documents:
      
      https://drive.google.com/file/d/1ggW0KJpUOR__vBkj3l61L2dav4ZkNC12/view?usp=sharing
      
      https://drive.google.com/file/d/1kTrflO9vvGlKp-ZH_jlgb9TY3WYG6FF9/view?usp=sharing
      8cfac237
    • Tom Rini's avatar
      Merge branch '2022-04-23-binman-updates' · bc9da9fb
      Tom Rini authored
      - Assorted binman updates, and add Alper as a maintainer, after talking
        with Simon.
      bc9da9fb
    • Heinrich Schuchardt's avatar
      binman: don't import deprecated distutils package · dd2e8ed4
      Heinrich Schuchardt authored and Tom Rini's avatar Tom Rini committed
      
      'make tests' fails on Ubuntu 22.04 with:
      
      binman: ./tools/binman/binman:12: DeprecationWarning:
      The distutils package is deprecated and slated for removal in Python 3.12.
      Use setuptools or check PEP 632 for potential alternatives
        from distutils.sysconfig import get_python_lib
      ./tools/binman/binman:12: DeprecationWarning:
      The distutils.sysconfig module is deprecated, use sysconfig instead
        from distutils.sysconfig import get_python_lib
      <unittest.result.TestResult run=428 errors=0 failures=4>
      AssertionError: 0 != 468
      
      As we don't use Ubuntu 16.04 for our CI anymore drop the import.
      
      Signed-off-by: default avatarHeinrich Schuchardt <heinrich.schuchardt@canonical.com>
      Reviewed-by: default avatarAlper Nebi Yasak <alpernebiyasak@gmail.com>
      dd2e8ed4
    • Alper Nebi Yasak's avatar
      MAINTAINERS: Add Alper as a binman maintainer · 06c73e37
      Alper Nebi Yasak authored and Tom Rini's avatar Tom Rini committed
      
      I ended up learning most of binman internals while trying to add a few
      features to it, and I recently started reviewing binman series that
      would not affect me personally. I'll keep working on it and try to do
      more reviews.
      
      Add myself as a maintainer for binman.
      
      Signed-off-by: default avatarAlper Nebi Yasak <alpernebiyasak@gmail.com>
      Acked-by: default avatarTom Rini <trini@konsulko.com>
      06c73e37
    • Alper Nebi Yasak's avatar
      binman: Refuse to replace sections for now · 82337bb6
      Alper Nebi Yasak authored and Tom Rini's avatar Tom Rini committed
      
      Binman interfaces allow attempts to replace any entry in the image with
      arbitrary data. When trying to replace sections, the changes in the
      section entry's data are not propagated to its child entries. This,
      combined with how sections rebuild their contents from its children,
      eventually causes the replaced contents to be silently overwritten by
      rebuilt contents equivalent to the original data.
      
      Add a simple test for replacing a section that is currently failing due
      to this behaviour, and mark it as an expected failure. Also, raise an
      error when replacing a section instead of silently pretending it was
      replaced.
      
      Signed-off-by: default avatarAlper Nebi Yasak <alpernebiyasak@gmail.com>
      Reviewed-by: Simon Glass's avatarSimon Glass <sjg@chromium.org>
      82337bb6
    • Alper Nebi Yasak's avatar
      binman: Test replacing non-section entries in FIT subsections · 99283e53
      Alper Nebi Yasak authored and Tom Rini's avatar Tom Rini committed
      
      A previous patch fixes binman to correctly extract FIT subentries. This
      makes it easier to test replacing these entries as we can write tests
      using an existing helper function that relies on extracting the replaced
      entry.
      
      Add tests that replace leaf entries in FIT subsections with data of
      various sizes. Replacing the subsections or the whole FIT section does
      not work yet due to the section contents being re-built from unreplaced
      subentries' data.
      
      Signed-off-by: default avatarAlper Nebi Yasak <alpernebiyasak@gmail.com>
      Reviewed-by: Simon Glass's avatarSimon Glass <sjg@chromium.org>
      99283e53
    • Alper Nebi Yasak's avatar
      binman: Create FIT subentries in the FIT section, not its parent · 74d3b231
      Alper Nebi Yasak authored and Tom Rini's avatar Tom Rini committed
      
      When reading images from a file, each entry's data is read from its
      parent section as specified in the Entry.Create() call that created it.
      The FIT entry type has been creating its subentries under its parent
      (their grandparent), as creating them under the FIT entry resulted in an
      error until FIT was converted into a proper section.
      
      FIT subentries have their offsets relative to the FIT section, and
      reading those offsets in the parent section results in wrong data. The
      subentries rightfully belong under the FIT entries, so create them
      there. Add tests checking that we can extract the correct data for a FIT
      entry and its subentries.
      
      Signed-off-by: default avatarAlper Nebi Yasak <alpernebiyasak@gmail.com>
      Reviewed-by: Simon Glass's avatarSimon Glass <sjg@chromium.org>
      74d3b231
    • Alper Nebi Yasak's avatar
      binman: Remove '/images/' fragment from FIT subentry paths · e736878b
      Alper Nebi Yasak authored and Tom Rini's avatar Tom Rini committed
      
      Binman FIT entry nodes describe their subentries in an 'images' subnode,
      same as how they would be written for the mkimage executable. The entry
      type initially manually managed its subentries keyed by their node paths
      relative to its base node. It was later converted to a proper section
      while still keeping the same keys for subentries.
      
      These subentry keys of sections are used as path fragments, so they must
      not contain the path separator character '/'. Otherwise, they won't be
      addressable by binman extract/replace commands. Change these keys from
      the '/images/foo' forms to the subentry node names. Extend the simple
      FIT tests to check for this.
      
      Signed-off-by: default avatarAlper Nebi Yasak <alpernebiyasak@gmail.com>
      e736878b
    • Alper Nebi Yasak's avatar
      binman: Don't reset offset/size if image doesn't allow repacking · e2ce4fb9
      Alper Nebi Yasak authored and Tom Rini's avatar Tom Rini committed
      
      When an image has the 'allow-repack' property, binman includes the
      original offset and size properties from the image description in the
      fdtmap. These are later used as the packing constraints when replacing
      entries in an image, so other unconstrained entries can be freely
      positioned.
      
      Replacing an entry in an image without 'allow-repack' (and therefore the
      original offsets) follows the same logic and results in entries being
      merely concatenated. Instead, skip resetting the calculated offsets and
      sizes to the missing originals for these images so that every entry is
      constrained to its existing offset/size.
      
      Add tests that replace an entry with smaller or equal-sized data, in an
      image that doesn't allow repacking. Attempting to do so with bigger-size
      data is already an error that is already being tested.
      
      Signed-off-by: default avatarAlper Nebi Yasak <alpernebiyasak@gmail.com>
      Reviewed-by: Simon Glass's avatarSimon Glass <sjg@chromium.org>
      e2ce4fb9
    • Alper Nebi Yasak's avatar
      binman: Collect bintools for images when replacing entries · 8ee4ec9b
      Alper Nebi Yasak authored and Tom Rini's avatar Tom Rini committed
      
      Binman entries can use other executables to compute their data, usually
      in their ObtainContents() methods. Subclasses of Entry_section would use
      bintools in their BuildSectionData() method instead, which is called
      from several places including their Pack().
      
      These binary tools are resolved correctly while building an image from a
      device-tree description so that they can be used from these methods.
      However, this is not being done when replacing entries in an image,
      which can result in an error as the Pack() methods attempt to use them.
      
      Collect and resolve entries' bintools also when replacing entries to fix
      Pack() errors. Add a way to mock bintool usage in the testing entry type
      and tests that check bintools are being resolved for such an entry.
      
      Signed-off-by: default avatarAlper Nebi Yasak <alpernebiyasak@gmail.com>
      Reviewed-by: Simon Glass's avatarSimon Glass <sjg@chromium.org>
      8ee4ec9b
    • Alper Nebi Yasak's avatar
      binman: Fix unique names having '/.' for images read from files · 67bf2c8d
      Alper Nebi Yasak authored and Tom Rini's avatar Tom Rini committed
      
      Binman can embed a copy of the image description into the images it
      builds as a fdtmap entry, but it omits the /binman/<image-name> prefix
      from the node paths while doing so. When reading an already-built image
      file, entries are reconstructed using this fdtmap and their associated
      nodes still lack that prefix.
      
      Some entries like fit and vblock create intermediate files whose names
      are based on an entry unique name. This name is constructed from their
      node's path by concatenating the parents with dots up to the binman
      node, e.g. /binman/image/foo/bar becomes 'image.foo.bar'.
      
      However, we don't have this /binman/image prefix when replacing entries
      in such an image. The /foo/bar entry we read when doing so erroneously
      has the unique name of '/.foo.bar', causing permission errors when the
      entry attempts to create files based on that.
      
      Fix the unique-name generation by stopping at the '/' node like how it
      stops at the binman node. As the unique names are used as filenames, add
      tests that check if they're safe to use as filenames.
      
      Signed-off-by: default avatarAlper Nebi Yasak <alpernebiyasak@gmail.com>
      Reviewed-by: Simon Glass's avatarSimon Glass <sjg@chromium.org>
      67bf2c8d
    • Simon Glass's avatar
      bootstd: doc: Add documentation · e7b2ce19
      Simon Glass authored and Tom Rini's avatar Tom Rini committed
      
      Add documentation for this feature, including the commands and full
      devicetree bindings.
      
      Signed-off-by: Simon Glass's avatarSimon Glass <sjg@chromium.org>
      e7b2ce19
    • Simon Glass's avatar
      bootstd: Provide a default command · a91492b6
      Simon Glass authored and Tom Rini's avatar Tom Rini committed
      
      We would like to use bootstd by default when EFI boot manager is not
      enabled. But so far bootstd does not support all the of distro-boot
      fetures. So for now, add an option to select this.
      
      Signed-off-by: Simon Glass's avatarSimon Glass <sjg@chromium.org>
      a91492b6
    • Simon Glass's avatar
      bootstd: Add setup for the bootflow tests · fca20a5a
      Simon Glass authored and Tom Rini's avatar Tom Rini committed
      
      We need to create a disk image with a partition table and a DOS-format
      filesystem containing a few files. Provide a fallback binary for CI since
      it does not seem able to detect the loopback partitions.
      
      Add this to a dm_init test so that it happens when needed.
      
      Signed-off-by: Simon Glass's avatarSimon Glass <sjg@chromium.org>
      fca20a5a
    • Simon Glass's avatar
      bootstd: Add tests for bootstd including all uclasses · fb1451be
      Simon Glass authored and Tom Rini's avatar Tom Rini committed
      
      Add a set of combined tests for the bootdev, bootflow and bootmeth
      commands, along with associated functionality.
      
      Expand the sandbox console-recording limit so that these can work.
      
      These tests rely on a filesystem script which is not yet added to the
      Python tests. It is included here as a shell script.
      
      Signed-off-by: Simon Glass's avatarSimon Glass <sjg@chromium.org>
      fb1451be
    • Simon Glass's avatar
      bootstd: usb: Add a bootdev driver · 0ccb0ac5
      Simon Glass authored and Tom Rini's avatar Tom Rini committed
      
      Add a bootdev driver for USB host. It can use the distro boot mechanism to
      locate a file, or any other available bootmeth.
      
      Signed-off-by: Simon Glass's avatarSimon Glass <sjg@chromium.org>
      0ccb0ac5
    • Simon Glass's avatar
      bootstd: Add an implementation of script boot · d9409244
      Simon Glass authored and Tom Rini's avatar Tom Rini committed
      
      Add a bootmeth driver which handles distro boot from a disk via a U-Boot
      script, so we can boot a bootflow using this commonly used mechanism. This
      is required by Armbian, for example.
      
      Signed-off-by: Simon Glass's avatarSimon Glass <sjg@chromium.org>
      d9409244
    • Simon Glass's avatar
      bootstd: sandbox: Add a hostfs bootdev · 7d0478d2
      Simon Glass authored and Tom Rini's avatar Tom Rini committed
      
      It is helpful to be able to try out bootstd on sandbox, using host files.
      This is easier than using a block device, which must have a filesystem,
      partition table, etc.
      
      Add a new driver which provides this feature. For now it is not used in
      tests, but it is likely to be useful.
      
      Add notes in the devicetree also, but don't disturb the tests.
      
      Signed-off-by: Simon Glass's avatarSimon Glass <sjg@chromium.org>
      7d0478d2
    • Simon Glass's avatar
      bootstd: Add a sandbox bootmeth driver · 126947b7
      Simon Glass authored and Tom Rini's avatar Tom Rini committed
      
      Add a bootmeth driver for sandbox, used for testing.
      
      Signed-off-by: Simon Glass's avatarSimon Glass <sjg@chromium.org>
      126947b7
    • Simon Glass's avatar
      bootstd: Add an implementation of EFI bootmgr · 0b41525e
      Simon Glass authored and Tom Rini's avatar Tom Rini committed
      
      Add a bootmeth driver which handles EFI boot manager, using EFI_LOADER.
      
      In effect, this provides the same functionality as the 'bootefi bootmgr'
      command and shares the same code. But the interface into it is via a
      bootmeth, so it does not require any special scripts, etc.
      
      For now this requires the 'bootefi' command be enabled. Future work may
      tidy this up so that it can be used without CONFIG_CMDLINE being enabled.
      
      Signed-off-by: Simon Glass's avatarSimon Glass <sjg@chromium.org>
      0b41525e
    • Simon Glass's avatar
      bootstd: Add a system bootdev for strange boot methods · a080b989
      Simon Glass authored and Tom Rini's avatar Tom Rini committed
      
      Some boot methods don't act on a single bootdev but instead do their own
      thing. An example is EFI bootmgr which scan various devices using its own
      logic. Add a bootdev to handle this.
      
      Signed-off-by: Simon Glass's avatarSimon Glass <sjg@chromium.org>
      a080b989
    • Simon Glass's avatar
      bootstd: Add an implementation of EFI boot · acfa9bdf
      Simon Glass authored and Tom Rini's avatar Tom Rini committed
      
      Add a bootmeth driver which handles EFI boot, using EFI_LOADER.
      
      In effect, this provides the same functionality as the 'bootefi' command
      and shares the same code. But the interface into it is via a bootmeth,
      so it does not require any special scripts, etc.
      
      For now this requires the 'bootefi' command be enabled. Future work may
      tidy this up so that it can be used without CONFIG_CMDLINE being enabled.
      
      There was much discussion about whether this is needed, but it seems
      that it is, at least for now.
      
      Signed-off-by: Simon Glass's avatarSimon Glass <sjg@chromium.org>
      acfa9bdf
    • Simon Glass's avatar
      bootstd: Add an implementation of distro PXE boot · dab2c285
      Simon Glass authored and Tom Rini's avatar Tom Rini committed
      
      Add a bootmeth driver which handles distro boot from a network device, so
      we can boot a bootflow using this commonly used mechanism.
      
      In effect, this provides the same functionality as the 'pxe' command
      and shares the same code. But the interface into it is via a bootmeth.
      
      For now this requires the 'pxe' command be enabled. Future work may tidy
      this up so that it can be used without CONFIG_CMDLINE being enabled.
      
      Signed-off-by: Simon Glass's avatarSimon Glass <sjg@chromium.org>
      dab2c285
    • Simon Glass's avatar
      bootstd: ethernet: Add a bootdev driver · 4fd8d077
      Simon Glass authored and Tom Rini's avatar Tom Rini committed
      
      Add a bootdev driver for Ethernet. It can use the PXE boot mechanism to
      locate a file, added later.
      
      Signed-off-by: Simon Glass's avatarSimon Glass <sjg@chromium.org>
      4fd8d077
    • Simon Glass's avatar
      bootstd: mmc: Add a bootdev driver · b8aa463e
      Simon Glass authored and Tom Rini's avatar Tom Rini committed
      
      Add a bootdev driver for MMC. It mostly just calls the bootdev helper
      function.
      
      Add a function to obtain the block device for an MMC controller.
      
      Fix up the comment for mmc_get_blk_desc() while we are here.
      
      Signed-off-by: Simon Glass's avatarSimon Glass <sjg@chromium.org>
      b8aa463e
    • Simon Glass's avatar
      bootstd: Add an implementation of distro boot · 31aefaf8
      Simon Glass authored and Tom Rini's avatar Tom Rini committed
      
      Add a bootmeth driver which handles distro boot from a disk, so we can
      boot a bootflow using this commonly used mechanism.
      
      In effect, this provides the same functionality as the 'sysboot' command
      and shares the same code. But the interface into it is via a bootmeth.
      
      For now this requires the 'pxe' command be enabled. Future work may tidy
      this up so that it can be used without CONFIG_CMDLINE being enabled.
      
      Signed-off-by: Simon Glass's avatarSimon Glass <sjg@chromium.org>
      31aefaf8
    • Simon Glass's avatar
      bootstd: Add a bootmeth command · 7fca71d0
      Simon Glass authored and Tom Rini's avatar Tom Rini committed
      
      Add a 'bootmeth' command to handle listing and ordering of boot methods.
      
      Signed-off-by: Simon Glass's avatarSimon Glass <sjg@chromium.org>
      7fca71d0
    • Simon Glass's avatar
      bootstd: Add a bootflow command · 2d653f68
      Simon Glass authored and Tom Rini's avatar Tom Rini committed
      
      Add a 'bootflow' command to handle listing and selection of bootflow.
      
      Signed-off-by: Simon Glass's avatarSimon Glass <sjg@chromium.org>
      2d653f68
    • Simon Glass's avatar
      bootstd: Add a bootdev command · 5d053cca
      Simon Glass authored and Tom Rini's avatar Tom Rini committed
      
      Add a 'bootdev' command to handle listing and selection of bootdevs.
      
      Disable standard boot for a few boards which otherwise run out of space.
      
      Signed-off-by: Simon Glass's avatarSimon Glass <sjg@chromium.org>
      5d053cca
    • Simon Glass's avatar
      bootstd: Add support for bootflows · a8f5be17
      Simon Glass authored and Tom Rini's avatar Tom Rini committed
      
      Add support for bootflows, including maintaining a list of them and
      iterating to find them.
      
      Signed-off-by: Simon Glass's avatarSimon Glass <sjg@chromium.org>
      a8f5be17
    • Simon Glass's avatar
      bootstd: Add the bootmeth uclass and helpers · a950d31a
      Simon Glass authored and Tom Rini's avatar Tom Rini committed
      
      A bootmeth is a method of locating an operating system. For now, just
      add the uclass itself. Drivers for particular bootmeths are added later.
      
      If no bootmeths devices are included in the devicetree, create them
      automatically. This avoids the need for boilerplate in the devicetree
      files.
      
      Signed-off-by: Simon Glass's avatarSimon Glass <sjg@chromium.org>
      a950d31a
    • Simon Glass's avatar
      bootstd: Add the bootdev uclass · 201417d7
      Simon Glass authored and Tom Rini's avatar Tom Rini committed
      
      A 'bootdev' is a device which can be used to boot an operating system.
      It is a child of the media device (e.g. MMC) which handles reading files
      from that device, such as a bootflow file.
      
      Add a uclass for bootdev and the various helpers needed to make it
      work. Also add a binding file, empty for now.
      
      Signed-off-by: Simon Glass's avatarSimon Glass <sjg@chromium.org>
      201417d7
    • Simon Glass's avatar
      bootstd: Add the bootstd uclass and core implementation · ef5e3891
      Simon Glass authored and Tom Rini's avatar Tom Rini committed
      
      The 'bootstd' device provides the central information about U-Boot
      standard boot.
      
      Add a uclass for bootstd and the various helpers needed to make it
      work. Also add a binding file.
      
      Signed-off-by: Simon Glass's avatarSimon Glass <sjg@chromium.org>
      ef5e3891
    • Simon Glass's avatar
      bootstd: Add the concept of a bootflow · 9d260253
      Simon Glass authored and Tom Rini's avatar Tom Rini committed
      
      A bootflow encapsulates the process used to boot an operating system.
      It typically has a control file (such as extlinux.conf) and information
      about which 'bootdev' it came from.
      
      Add the header file for this first, since it is needed by all other
      files.
      
      Signed-off-by: Simon Glass's avatarSimon Glass <sjg@chromium.org>
      9d260253
    • Simon Glass's avatar
      fs: Add a function to set the filesystem type · c24e58f5
      Simon Glass authored and Tom Rini's avatar Tom Rini committed
      
      When sandbox is used with hostfs we won't have a block device, but still
      must set up the filesystem type before any filesystem operation, such as
      loading a file. Add a function to handle this.
      
      Signed-off-by: Simon Glass's avatarSimon Glass <sjg@chromium.org>
      c24e58f5
    • Simon Glass's avatar
      dm: blk: Add a function to return the device type · 87571b7f
      Simon Glass authored and Tom Rini's avatar Tom Rini committed
      
      Use the uclass name to get the device type for a block device.
      
      Signed-off-by: Simon Glass's avatarSimon Glass <sjg@chromium.org>
      87571b7f
    • Simon Glass's avatar
      test: dm: Restart USB before assuming it is stopped · 026e2136
      Simon Glass authored and Tom Rini's avatar Tom Rini committed
      
      Update the blk test to stop USB first, in case another test has started
      it.
      
      Signed-off-by: Simon Glass's avatarSimon Glass <sjg@chromium.org>
      026e2136
    • Simon Glass's avatar
      test: fastboot: Avoid using mmc1 · 9bd2f62d
      Simon Glass authored and Tom Rini's avatar Tom Rini committed
      
      The bootflow tests need to use an MMC with an associated backing file
      containing a filesystem. Update the fastboot tests to cope with this.
      
      Signed-off-by: Simon Glass's avatarSimon Glass <sjg@chromium.org>
      9bd2f62d
    • Simon Glass's avatar
      dm: core: Allow finding a uclass device by partial name · 4e0710a2
      Simon Glass authored and Tom Rini's avatar Tom Rini committed
      
      In some cases two devices are related and the only way to tell is to
      check that the names partially patch. Add a way to check this without
      needing to create a new string for the comparison.
      
      Fix the comment for device_find_child_by_namelen() while we are here.
      
      Signed-off-by: Simon Glass's avatarSimon Glass <sjg@chromium.org>
      4e0710a2
Loading