-
-
Notifications
You must be signed in to change notification settings - Fork 14.7k
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
feat: add support for the RaspberryPi CM4 #170528
Changes from all commits
d1fef1e
faf42ff
f6f41cf
d094a3e
ca0c927
323f123
dcfaae6
aca45f8
b30105b
11c1152
cff95d1
77bb75d
21b2844
0594277
80d4480
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -40,6 +40,9 @@ in | |
# SD cards. | ||
"sdhci_pci" | ||
|
||
# NVMe drives | ||
"nvme" | ||
|
||
# Firewire support. Not tested. | ||
"ohci1394" "sbp2" | ||
|
||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -10,6 +10,7 @@ | |
, openssl | ||
, swig | ||
, meson-tools | ||
, which | ||
, armTrustedFirmwareAllwinner | ||
, armTrustedFirmwareAllwinnerH616 | ||
, armTrustedFirmwareRK3328 | ||
|
@@ -19,10 +20,10 @@ | |
}: | ||
|
||
let | ||
defaultVersion = "2021.10"; | ||
defaultVersion = "2022.01"; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Why not the newer version? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Because our precious patches don't work there yet. I might try rebasing them later, but I must admit I'm running out of gas :P There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. [See other comment too] I know I haven't been updating the last two releases (I wonder why r-ryantm didn't notice, and no one else did), but the goal is to prevent any kind of foward-incompatible drift; so we shouldn't block the upgrade to the current version. |
||
defaultSrc = fetchurl { | ||
url = "ftp://ftp.denx.de/pub/u-boot/u-boot-${defaultVersion}.tar.bz2"; | ||
sha256 = "1m0bvwv8r62s4wk4w3cmvs888dhv9gnfa98dczr4drk2jbhj7ryd"; | ||
hash = "sha256-gbRUMifbIowD+KG/XdvIE7C7j2VVzkYGTvchpvxoBBM="; | ||
}; | ||
buildUBoot = { | ||
version ? null | ||
|
@@ -66,11 +67,14 @@ let | |
p.setuptools # for pkg_resources | ||
])) | ||
swig | ||
which # for scripts/dtc-version.sh | ||
]; | ||
depsBuildBuild = [ buildPackages.stdenv.cc ]; | ||
|
||
hardeningDisable = [ "all" ]; | ||
|
||
enableParallelBuilding = true; | ||
lovesegfault marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
makeFlags = [ | ||
"DTC=dtc" | ||
"CROSS_COMPILE=${stdenv.cc.targetPrefix}" | ||
|
@@ -102,9 +106,6 @@ let | |
runHook postInstall | ||
''; | ||
|
||
# make[2]: *** No rule to make target 'lib/efi_loader/helloworld.efi', needed by '__build'. Stop. | ||
enableParallelBuilding = false; | ||
|
||
dontStrip = true; | ||
|
||
meta = with lib; { | ||
|
@@ -373,14 +374,6 @@ in { | |
CONFIG_USB_EHCI_GENERIC=y | ||
CONFIG_USB_XHCI_HCD=y | ||
''; | ||
extraPatches = [ | ||
# https://patchwork.ozlabs.org/project/uboot/list/?series=268007&state=%2A&archive=both | ||
# Remove when upgrading to 2022.01 | ||
(fetchpatch { | ||
url = "https://patchwork.ozlabs.org/series/268007/mbox/"; | ||
sha256 = "sha256-xn4Q959dgoB63zlmJepI41AXAf1kCycIGcmu4IIVjmE="; | ||
}) | ||
]; | ||
extraMeta.platforms = [ "i686-linux" "x86_64-linux" ]; | ||
filesToInstall = [ "u-boot.rom" ]; | ||
}; | ||
|
@@ -401,28 +394,12 @@ in { | |
defconfig = "rpi_3_32b_defconfig"; | ||
extraMeta.platforms = ["armv7l-linux"]; | ||
filesToInstall = ["u-boot.bin"]; | ||
extraPatches = [ | ||
# Remove when updating to 2022.01 | ||
# https://patchwork.ozlabs.org/project/uboot/list/?series=273129&archive=both&state=* | ||
(fetchpatch { | ||
url = "https://patchwork.ozlabs.org/series/273129/mbox/"; | ||
sha256 = "sha256-/Gu7RNvBNYCGqdFRzQ11qPDDxgGVpwKYYw1CpumIGfU="; | ||
}) | ||
]; | ||
}; | ||
|
||
ubootRaspberryPi3_64bit = buildUBoot { | ||
defconfig = "rpi_3_defconfig"; | ||
extraMeta.platforms = ["aarch64-linux"]; | ||
filesToInstall = ["u-boot.bin"]; | ||
extraPatches = [ | ||
# Remove when updating to 2022.01 | ||
# https://patchwork.ozlabs.org/project/uboot/list/?series=273129&archive=both&state=* | ||
(fetchpatch { | ||
url = "https://patchwork.ozlabs.org/series/273129/mbox/"; | ||
sha256 = "sha256-/Gu7RNvBNYCGqdFRzQ11qPDDxgGVpwKYYw1CpumIGfU="; | ||
}) | ||
]; | ||
}; | ||
|
||
ubootRaspberryPi4_32bit = buildUBoot { | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -32,20 +32,19 @@ stdenv.mkDerivation { | |
mkdir -p "$out/lib/firmware/brcm" | ||
|
||
# Wifi firmware | ||
shopt -s extglob | ||
for filename in firmware-nonfree/brcm/brcmfmac434??{,s}-sdio.*; do | ||
cp "$filename" "$out/lib/firmware/brcm" | ||
done | ||
cp -rv "$NIX_BUILD_TOP/firmware-nonfree/debian/config/brcm80211/." "$out/lib/firmware/" | ||
|
||
# Bluetooth firmware | ||
cp bluez-firmware/broadcom/*.hcd "$out/lib/firmware/brcm" | ||
cp -rv "$NIX_BUILD_TOP/bluez-firmware/broadcom/." "$out/lib/firmware/brcm" | ||
|
||
# CM4 symlink must be added since it's missing from upstream | ||
pushd $out/lib/firmware/brcm &>/dev/null | ||
ln -s "./brcmfmac43455-sdio.txt" "$out/lib/firmware/brcm/brcmfmac43455-sdio.raspberrypi,4-compute-module.txt" | ||
popd &>/dev/null | ||
|
||
runHook postInstall | ||
''; | ||
|
||
outputHashMode = "recursive"; | ||
outputHashAlgo = "sha256"; | ||
outputHash = "sha256-Fw8EC1jzszWg9rNH01oaOIHnSYDuF6ov6ulmIAPuNz4="; | ||
|
||
Comment on lines
-45
to
-48
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. AFAIK all firmware packages should use FOD to reduce unneeded rebuilds. [citation needed]. (Personally I find it is an abuse of FODs, though that might only apply to the big linux-firmware package.) There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yeah, this doesn't really cause any big rebuilds AFAICT |
||
meta = with lib; { | ||
description = "Firmware for builtin Wifi/Bluetooth devices in the Raspberry Pi 3+ and Zero W"; | ||
homepage = "https://github.com/RPi-Distro/firmware-nonfree"; | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This might be problematic, depending on the CM4 usage. Is it a good idea to outright apply this?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think the vast majority of users will want this, and the minority who don't can still override it.