Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add initial support for the ThinkPad T440p #1282

Merged
merged 19 commits into from
Feb 28, 2023

Commits on Jan 18, 2023

  1. Add script for obtaining Haswell mrc.bin blob

    I based this script on the Coreboot docs:
    https://doc.coreboot.org/northbridge/intel/haswell/mrc.bin.html. While
    adding an integrity check to ensure we're obtaining the correct blob.
    
    Also, it's worth surfacing that the SHA-1 for the resulting binary is
    the same SHA that Libreboot uses in their integrity check:
    https://notabug.org/libreboot/lbmk/src/master/resources/scripts/download/mrc#L95.
    However, I elected to use SHA-256 for extra paranoia.
    rbreslow committed Jan 18, 2023
    Configuration menu
    Copy the full SHA
    5cce937 View commit details
    Browse the repository at this point in the history
  2. Add initial T440p Coreboot defconfig

    I generated this config by walking through Coreboot's `make menuconfig`.
    The plan is to pare down verbose defaults and tweak from here.
    rbreslow committed Jan 18, 2023
    Configuration menu
    Copy the full SHA
    e325976 View commit details
    Browse the repository at this point in the history
  3. Configuration menu
    Copy the full SHA
    96f0c5b View commit details
    Browse the repository at this point in the history
  4. Adjust T440p default Coreboot defconfig options

    Remove options that haven't deviated from defaults in the Coreboot
    Kconfig, despite being saved by `make savedefconfig`. Also, add
    `CONFIG_BOARD_LENOVO_THINKPAD_T440P`, which was missing from the `make
    savedefconfig` output, causing Heads builds to fail. And finally, bump
    `CONFIG_CBFS_SIZE` to `0x800000` (8 MiB to bytes to hexadecimal).
    
    This value for the CBFS size is arbitrary. Originally, I had totaled the
    size of all binary blobs, subtracted that from the T440p's ROM size (12
    MiB), and used the remaining space as the CBFS size (~11.68 MiB).
    However, this caused very long RAM initialization times (courtesy of
    `cbmem -t`). And, an anecdote in
    https://groups.google.com/a/chromium.org/g/chromium-os-reviews/c/lUqRrGUoEBY/m/ka7L1f2BS8gJ
    suggested that this value needs to be a power of 2.
    
    So, I picked a size I expected our Linux payload to fit into that was a
    power of 2 that I also expected would leave enough space in the ROM for
    the IFD, ME, GbE, and Coreboot.
    
    Now, it takes less than a second for RAM initialization after
    flashing/first boot (anecdotally, it seems the MRC needs to be
    "trained?").
    rbreslow committed Jan 18, 2023
    Configuration menu
    Copy the full SHA
    f079211 View commit details
    Browse the repository at this point in the history
  5. Configuration menu
    Copy the full SHA
    65be2c5 View commit details
    Browse the repository at this point in the history
  6. Add intel_iommu=igfx_off to T440p Coreboot kernel parameters

    Without this, neither Qubes OS nor the Qubes OS installer would start.
    Presumably, because we're "kexecing" from an already running kernel, we
    need this set at the Coreboot level? Testing revealed that including
    `intel_iommu=igfx_off` in the `CONFIG_BOOT_KERNEL_ADD` board config
    option did nothing. And, the Qubes OS default boot option already
    contains `intel_iommu=igfx_off`.
    
    See:
    - https://www.qubes-os.org/doc/installation-troubleshooting/#not-asking-for-vnc-because-we-dont-have-a-network--x-startup-failed-aborting-installation--pane-is-dead-error-during-installation
    - https://github.com/Qubes-Community/Contents/blob/master/docs/troubleshooting/intel-igfx-troubleshooting.md
    - https://www.kernel.org/doc/html/v5.10/x86/intel-iommu.html?highlight=igfx_off#graphics-problems
    rbreslow committed Jan 18, 2023
    Configuration menu
    Copy the full SHA
    24d23ff View commit details
    Browse the repository at this point in the history

Commits on Jan 20, 2023

  1. Configuration menu
    Copy the full SHA
    c23ed54 View commit details
    Browse the repository at this point in the history

Commits on Jan 24, 2023

  1. t440p: disable NVMe support in Linux kernel

    I went through all of the different options we copied from the Librem
    config. The only thing that stood out as irrelevant was NVMe support.
    However, I'm not a Linux kernel expert, and I didn't do a deep dive, so
    I'm sure there is still room for improvement.
    rbreslow committed Jan 24, 2023
    Configuration menu
    Copy the full SHA
    7a29db1 View commit details
    Browse the repository at this point in the history
  2. Add script for obtaining T440p me.bin blob

    I performed an analysis of the differences between an me.bin blob I
    extracted from my T440p and the me.bin blob from Lenovo's website:
    linuxboot#1282 (comment).
    rbreslow committed Jan 24, 2023
    Configuration menu
    Copy the full SHA
    ed8c74e View commit details
    Browse the repository at this point in the history

Commits on Feb 26, 2023

  1. Rename T440p export-blobs script to extract

    More aligned with the naming conventions of xx20 and xx30's extract.sh.
    rbreslow committed Feb 26, 2023
    Configuration menu
    Copy the full SHA
    9368404 View commit details
    Browse the repository at this point in the history
  2. Add T440p ifd.bin blob

    I extracted the ifd.bin blob from my T440p using the blobs/t440p/extract
    script.
    rbreslow committed Feb 26, 2023
    Configuration menu
    Copy the full SHA
    7c32d4e View commit details
    Browse the repository at this point in the history
  3. Add T440p gbe.bin blob

    - I extracted the gbe.bin blob from my T440p's original ROM using the
      blobs/t440p/extract script.
    - Using a hex editor, I corrected the sign bit in part 0 that I found
      was malformed in my analysis:
      linuxboot#1282 (comment).
    - After correcting the sign bit, nvmutil showed that both parts of my
      gbe.bin blob had valid checksums.
    - Finally, I used nvmutil to set the MAC address to 00:de:ad:c0:ff:ee.
    rbreslow committed Feb 26, 2023
    Configuration menu
    Copy the full SHA
    e6c34bd View commit details
    Browse the repository at this point in the history
  4. Make T440p scripts use Coreboot from environment

    Before, the T440p blob scripts would look for Coreboot using the find
    command. Now, we require the user to specify the path to Coreboot in the
    COREBOOT_DIR environment variable. Also, add an output directory
    argument to each script.
    
    These changes will make it easier to integrate with the Heads build
    system and CI.
    rbreslow committed Feb 26, 2023
    Configuration menu
    Copy the full SHA
    144f9c1 View commit details
    Browse the repository at this point in the history
  5. Make T440p Coreboot build depend on blob files

    Now, when you run `make BOARD=any-t440p-variant`, the build system
    automatically fetches mrc.bin and me.bin.
    rbreslow committed Feb 26, 2023
    Configuration menu
    Copy the full SHA
    1dc5d4e View commit details
    Browse the repository at this point in the history
  6. Add the T440p to CircleCI

    rbreslow committed Feb 26, 2023
    Configuration menu
    Copy the full SHA
    5083ba3 View commit details
    Browse the repository at this point in the history
  7. CircleCI: Install crosfirmware.sh dependencies

    We need extra dependencies to support Coreboot's util/crosfirmware.sh to
    extract the T440p's mrc.bin.
    rbreslow committed Feb 26, 2023
    Configuration menu
    Copy the full SHA
    3efec15 View commit details
    Browse the repository at this point in the history

Commits on Feb 28, 2023

  1. Make T440p scripts work with relative paths

    Because we're using pushd/popd to make the Coreboot util invocation
    cleaner, we need to use realpath so that the scripts will work with any
    user input.
    rbreslow committed Feb 28, 2023
    Configuration menu
    Copy the full SHA
    63eab71 View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    e4a09e8 View commit details
    Browse the repository at this point in the history
  3. CircleCI: Make the T440p depend on Librem boards

    This change will improve build times by allowing the T440p to share the
    Coreboot 4.17 cache with the Librem boards. Once we update the other
    ThinkPad boards to use Coreboot 4.19, we'll make the T440p depend on the
    X230 again.
    
    Co-authored-by: Thierry Laurion <insurgo@riseup.net>
    rbreslow and tlaurion committed Feb 28, 2023
    Configuration menu
    Copy the full SHA
    1dd9c26 View commit details
    Browse the repository at this point in the history