~amjoseph/ownerboot

453d11d479c01d02a438896c3c0916b14d9bcb3c — Adam Joseph a month ago 61416b8
am1i: fix typo in 8mbyte single-image case

This commit fixes a typo which would cause the am1i image to fail to build in
the single-image (`--arg flash-chip-size-in-mbytes 8`) case.
1 files changed, 8 insertions(+), 11 deletions(-)

M src/platform/am1i/default.nix
M src/platform/am1i/default.nix => src/platform/am1i/default.nix +8 -11
@@ 40,12 40,11 @@
    payload = "${final.kernel}/bzImage";
    fmap = final.nixpkgsOnBuildForBuild.writeText "custom.fmap" (''
      #
      # Note: on x86 platforms the SPI flash is mapped into or copied into
      # the topmost X bytes of memory, and the very topmost word of memory
      # is the "reset vector" which points to the BIOS entry point.  Because
      # of this we must protect the TOPMOST half of memory; if an attacker
      # controls the reset vector and any other chunk of the flash, the game
      # is over.
      # Note: on x86 platforms the SPI flash is copied into the topmost X
      # bytes of memory, and the very topmost word of memory is the "reset
      # vector" which points to the BIOS entry point.  Because of this we
      # must protect the TOPMOST half of memory; if an attacker controls the
      # reset vector and any other chunk of the flash, the game is over.
      #
      FLASH@0 0x${lib.toHexString final.flash-chip-size-in-bytes} {
        BIOS@0 0x${lib.toHexString final.flash-chip-size-in-bytes} {


@@ 54,11 53,9 @@
          NORMAL(CBFS)   @    0x${lib.toHexString fmap-size-in-bytes} 0x${lib.toHexString cbfs-size-in-bytes}
    '' + ''

    '' + lib.optionalString (final.images-per-flash-chip > 1) ''
          # read-only zone (eventually)
          FMAP           @ 0x${lib.toHexString flash-chip-bytes-per-image}    0x${lib.toHexString fmap-size-in-bytes}
          FALLBACK(CBFS) @ 0x${lib.toHexString (flash-chip-bytes-per-image + fmap-size-in-bytes)} 0x${lib.toHexString cbfs-size-in-bytes}
    '' + ''
          # read-only zone
          FMAP           @ 0x${lib.toHexString fallback-image-address-in-bytes}    0x${lib.toHexString fmap-size-in-bytes}
          FALLBACK(CBFS) @ 0x${lib.toHexString (fallback-image-address-in-bytes + fmap-size-in-bytes)} 0x${lib.toHexString cbfs-size-in-bytes}
        }
      }
    '');