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

u-boot: 2023.07.02 -> 2023.10 #258701

Closed
wants to merge 4 commits into from
Closed

u-boot: 2023.07.02 -> 2023.10 #258701

wants to merge 4 commits into from

Conversation

jmbaur
Copy link
Contributor

@jmbaur jmbaur commented Oct 3, 2023

Description of changes

Among other changes, this release moves more boards to use the new environment format where a simple text file is used under ./board rather than using CFG_EXTRA_ENV_SETTINGS. This includes the default environment for the raspberry pi, hence the change of patch.

Something I haven't been able to track down is the need for removing the DTC make flag. U-boot has a version of this (along with libfdt) in their tree that builds just fine, so I propose we use that instead.

I've tested these changes building various boards defined in nixpkgs (cross compiling from x86_64-linux) with good success. I'm not sure of the expectation that every u-boot board defined in nixpkgs build successfully, (as I saw one with an incorrect filesToInstall), so I have not tested all boards. Please test if these changes break your board!

Things done

  • Built on platform(s)
    • x86_64-linux
    • aarch64-linux
    • x86_64-darwin
    • aarch64-darwin
  • For non-Linux: Is sandbox = true set in nix.conf? (See Nix manual)
  • Tested, as applicable:
  • Tested compilation of all packages that depend on this change using nix-shell -p nixpkgs-review --run "nixpkgs-review rev HEAD". Note: all changes have to be committed, also see nixpkgs-review usage
  • Tested basic functionality of all binary files (usually in ./result/bin/)
  • 23.11 Release Notes (or backporting 23.05 Release notes)
    • (Package updates) Added a release notes entry if the change is major or breaking
    • (Module updates) Added a release notes entry if the change is significant
    • (Module addition) Added a release notes entry if adding a new NixOS module
  • Fits CONTRIBUTING.md.

jmbaur added 2 commits October 2, 2023 19:24
U-boot seems to have a dtc and libfdt implementation that works better
with their build system. Use that instead. Builds fail when specifying
`DTC=<our dtc>`.
There does not exist a file to install at $BUILD/u-boot-spl.bin, but
there is a file named $BUILD/u-boot-with-spl.bin, which is most likely
the file that a user wants to boot their clearfog device with.
@jmbaur
Copy link
Contributor Author

jmbaur commented Oct 3, 2023

@ofborg build pkgsCross.aarch64-multiplatform.ubootRaspberryPi4_64bit

@ofborg ofborg bot requested review from dezgeg, lopsided98 and samueldr October 3, 2023 03:02
@ofborg ofborg bot added 10.rebuild-darwin: 0 This PR does not cause any packages to rebuild on Darwin 10.rebuild-linux: 1-10 labels Oct 3, 2023
@jmbaur
Copy link
Contributor Author

jmbaur commented Oct 3, 2023

@ofborg build ubootTools

Copy link
Member

@samueldr samueldr left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(No changes requested)

All devices should be tried to be built (pkgsCross on their arch) before merging.

It is fine to assume built == valid, given the track record of U-Boot.

The mkimage tool requires openssl for the host platform.
@jmbaur
Copy link
Contributor Author

jmbaur commented Oct 4, 2023

I quickly built all immediately build-able (with a pkgsCross package set available) u-boot derivations and gathered the results here: https://gist.github.com/jmbaur/466df3f4200914f906c05994d3f38674. All of them that fail also fail on master for the same reason. Luckily the failure is the same, so the fix should be easy. I'm happy to try and track down the SCP binary for these boards and include that in this PR, I'm assuming this means they will need to be marked unfree. I'm also happy keeping them broken and fixing them in a separate PR, just let me know. I also fixed cross-compilation of ubootTools.

@jmbaur jmbaur requested a review from samueldr October 4, 2023 03:19
@lopsided98
Copy link
Contributor

This PR fixes the SCP build failures: #252111

@lopsided98
Copy link
Contributor

These are the attributes for the builds with question marks:

pkgsCross.raspberryPi.ubootRaspberryPi
pkgsCross.raspberryPi.ubootRaspberryPiZero
pkgsCross.sheevaplug.ubootSheevaplug
pkgsCross.sheevaplug.ubootGuruplug

@jmbaur
Copy link
Contributor Author

jmbaur commented Oct 4, 2023

Thanks @lopsided98! The rest of them build successfully (gist updated), and that PR you linked would cover the rest that are failing.

@lopsided98
Copy link
Contributor

lopsided98 commented Oct 5, 2023

Successfully booted:

Failed:

@samueldr
Copy link
Member

samueldr commented Oct 5, 2023

When looking for Tow-Boot, I've observed that all Raspberry Pi boards were moved to bootstd. So depending on the exact setup, it might be related to that move.

@lopsided98
Copy link
Contributor

I thought I had a saved environment on this RPi4, which might have broken things with bootstd, but this wasn't the problem.

The real problem is that, by default, U-Boot has boot_targets=mmc usb pxe dhcp. This appears to make it try mmc 1 first, which is an unconnected interface on the RPi4. This obviously fails, but rather than trying mmc 0, it just moves on to USB and PXE. Explicitly specifying boot_targets=mmc0 makes it boot successfully. Interestingly, u-boot/u-boot@c771e5b says:

We don't need to specify the mmc devices individually, since they are
used in order from 0 to 2, and standard boot uses that order anyway.

This appears to be incorrect, and the fix is probably to set boot_targets=mmc0 mmc1 mmc2 usb pxe dhcp

@lopsided98
Copy link
Contributor

Another odd RPi4 bug: the 2 second boot delay takes closer to 10 seconds

@jmbaur
Copy link
Contributor Author

jmbaur commented Oct 7, 2023

I added a patch to address this, let me know if you think this is appropriate or not. Unfortunately I do not have an rpi to try and reproduce this, but I'll check out the behavior on qemu with bootstd.

Edit: behavior on qemu with two virtio drives looks fine, bootflow scan -lb tries the first disk before trying the second, though this really isn't representative of what it seems like is happening on the rpi.

@lopsided98
Copy link
Contributor

I submitted the patch upstream; we'll see what they think: https://patchwork.ozlabs.org/project/uboot/patch/[email protected]/

@jmbaur jmbaur force-pushed the uboot-2023.10 branch 2 times, most recently from 2f48bfc to 4d2e0c3 Compare October 7, 2023 20:16
@ofborg ofborg bot requested a review from samueldr October 7, 2023 21:04
@lopsided98
Copy link
Contributor

Upstream suggested trying this patch, which also fixes the RPi4 issue: https://patchwork.ozlabs.org/project/uboot/patch/[email protected]/

This patch enables the raspberry pi (and really any board using standard
boot without BOOTSTD_FULL) to boot properly when `boot_targets` only
specifies the uclass of the device to boot from (e.g. "mmc" rather than
"mmc0").
@jmbaur
Copy link
Contributor Author

jmbaur commented Oct 9, 2023

I included the patch here: https://patchwork.ozlabs.org/project/uboot/patch/[email protected]/raw

@sorki
Copy link
Member

sorki commented Oct 18, 2023

I missed this one and created #261775 which does bunch of other things as well.

Except for DTC=dtc removal the first patch is pretty much identical

  • I've added another patch fixing QEMU test
  • We can still use external dtc but it has to be a full path otherwise it fails horribly.

@jmbaur do you mind if I pick the 3 other patches to my branch and we continue there?

@jmbaur
Copy link
Contributor Author

jmbaur commented Oct 20, 2023

@sorki that sounds good to me!

@jmbaur
Copy link
Contributor Author

jmbaur commented Oct 20, 2023

closed in favor of #261775

@jmbaur jmbaur closed this Oct 20, 2023
@sorki
Copy link
Member

sorki commented Oct 20, 2023

Much appreciated @jmbaur!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
10.rebuild-darwin: 0 This PR does not cause any packages to rebuild on Darwin 10.rebuild-linux: 1-10
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants