You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

92 lines
3.8 KiB
Nix

{
hostPlatform = (import <nixpkgs/lib>).systems.examples.aarch64-multiplatform;
overlay = (final: prev: {
nixpkgsOnBuildForHost = prev.nixpkgsOnBuildForBuild.pkgsCross.aarch64-multiplatform;
platform_name = "kevin";
kernel =
let version = "5.10.10"; in
final.lib.makeOverridable (prev.kernel.override {
config = ./linux.config;
buildTargets = [ "Image" "dtbs" ];
}).overrideAttrs (a: {
inherit version;
src = final.nixpkgsOnBuildForBuild.fetchurl {
url = "mirror://kernel/linux/kernel/v5.x/linux-${version}.tar.xz";
sha256 = "sha256-YO2Gb6lRUipSVeo37DrCAG0/NCfUeDoT70eEZPN82xk=";
# FIXME: add the patches
};
postInstall = (a.postInstall or "") + ''
lzma < arch/arm64/boot/Image > $out/Image.lzma
cp arch/arm64/boot/dts/rockchip/rk3399-gru-kevin.dtb $out/
'';
});
initramfs = prev.initramfs.override {
userspace = prev.initramfs.passthru.userspace.override {
# order matters! this is also the order in which the modules are insmoded
modules_insmod = [
"drivers/video/backlight/pwm_bl.ko"
"drivers/gpu/drm/panel/panel-simple.ko"
"drivers/gpu/drm/bridge/analogix/analogix_dp.ko"
"drivers/gpu/drm/bridge/synopsys/dw-mipi-dsi.ko"
"drivers/gpu/drm/bridge/synopsys/dw-hdmi.ko"
"drivers/gpu/drm/rockchip/rockchipdrm.ko"
"drivers/usb/dwc3/dwc3-of-simple.ko"
"drivers/usb/dwc3/dwc3.ko"
"drivers/usb/host/ehci-hcd.ko"
"drivers/usb/host/ehci-platform.ko"
"drivers/usb/host/ohci-hcd.ko"
"drivers/usb/host/ohci-platform.ko"
"drivers/usb/storage/usb-storage.ko"
"drivers/usb/storage/uas.ko"
"drivers/usb/host/xhci-hcd.ko"
"drivers/usb/host/xhci-plat-hcd.ko"
];
# FIXME: need firmware for mwifiex and ath9k as well.
modules_noinsmod = [
"lib/crypto/libarc4.ko"
"net/mac80211/mac80211.ko"
"drivers/net/wireless/ath/ath9k/ath9k.ko"
"drivers/net/wireless/ath/ath9k/ath9k_common.ko"
"drivers/net/wireless/ath/ath9k/ath9k_htc.ko"
"drivers/net/wireless/ath/ath9k/ath9k_hw.ko"
"drivers/net/wireless/ath/ath.ko"
"drivers/net/wireless/marvell/mwifiex/mwifiex_pcie.ko"
"drivers/net/wireless/marvell/mwifiex/mwifiex.ko"
];
};
};
coreboot =
let atf = final.nixpkgsOnBuildForHost.callPackage (import ./atf) {
buildArmTrustedFirmware = (final.nixpkgsOnBuildForHost.callPackage (import <nixpkgs/pkgs/misc/arm-trusted-firmware>) {
unfreeIncludeHDCPBlob = false;
openssl = null; # not sure why they would link in openssl...
}).buildArmTrustedFirmware;
};
fit = final.nixpkgsOnBuildForBuild.callPackage (import ./fit) {
inherit (final) initramfs kernel;
};
in final.lib.makeOverridable (prev.coreboot.override {
payload = "${fit}/Image.fit";
fmap = ./custom.fmap;
config = ./coreboot.config;
coreboot-toolchain = with final.coreboot-toolchain; [ aarch64 ];
}).overrideAttrs (a: {
postConfigure = ''
echo CONFIG_ARM64_BL31_EXTERNAL_FILE=\"${atf}/bl31.elf\" >> .config
mkdir -p 3rdparty/arm-trusted-firmware/plat/rockchip/common/include/
ln -s ${atf}/plat_params.h 3rdparty/arm-trusted-firmware/plat/rockchip/common/include/
mkdir -p 3rdparty/arm-trusted-firmware/plat/rockchip/rk3399/include/shared/
ln -s ${atf}/bl31_param.h 3rdparty/arm-trusted-firmware/plat/rockchip/rk3399/include/shared/
mkdir -p 3rdparty/arm-trusted-firmware
ln -s ${atf}/include 3rdparty/arm-trusted-firmware/include
'';
});
});
}