dotfiles/overlays/uboot/bpi-r4.nix
magic_rb 4435cdfec7
Move out custom kernels and uboots into overlays
Signed-off-by: magic_rb <magic_rb@redalder.org>
2024-08-14 22:21:42 +02:00

96 lines
2.1 KiB
Nix

{
buildUBoot,
unixtools,
bison,
bc,
flex,
ubootTools,
buildPackages,
dtc,
lib,
blink,
fetchFromGitHub,
buildArmTrustedFirmware,
symlinkJoin,
}: let
inherit
(buildPackages)
openssl
;
opensslCombined = symlinkJoin {
name = openssl.name + "-combined";
paths = [
openssl.dev
openssl.out
openssl.bin
];
};
armTrustedFirmwareMTK = buildArmTrustedFirmware rec {
platform = "mt7988";
# src = fetchFromGitHub {
# owner = "mtk-openwrt";
# repo = "arm-trusted-firmware";
# rev = "bacca82a8cac369470df052a9d801a0ceb9b74ca";
# hash = "sha256-n5D3styntdoKpVH+vpAfDkCciRJjCZf9ivrI9eEdyqw=";
# };
src = fetchFromGitHub {
owner = "frank-w";
repo = "u-boot";
rev = "7154cf66405cfb42855f2e4f419dece0639e6dd1";
hash = "sha256-SNIc4NhviQTkYpND2/+Bs0Ws24S+Z7STeGggFzBWYGg=";
};
extraMakeFlags = [
"BOOT_DEVICE=sdmmc"
"DRAM_USE_COMB=1"
"BL33=${uboot}/u-boot-dtb.bin"
"USE_MKIMAGE=1"
"MKIMAGE=${ubootTools}/bin/mkimage"
"OPENSSL_DIR=${opensslCombined}"
"all"
"fip"
];
nativeBuildInputs = [
dtc
opensslCombined
];
extraMeta.platforms = ["aarch64-linux"];
filesToInstall = [
"build/${platform}/release/bl31.bin"
"build/${platform}/release/bl2.img"
"build/${platform}/release/fip.bin"
];
};
uboot = buildUBoot {
version = "master";
nativeBuildInputs = [
unixtools.xxd
bison
flex
openssl
bc
];
# BL31 = "${armTrustedFirmwareMTK}/bin/bl31.bin";
src = fetchFromGitHub {
owner = "frank-w";
repo = "u-boot";
rev = "285dd4d9eadb70d1dbd56671c65debade59592c7";
hash = "sha256-5OeVaOw5TA8yrzKMFmvtDb7ebZgNkDzFMnzgGbCMZrE=";
};
extraConfig = ''
CONFIG_BOOTSTD=y
CONFIG_BOOTMETH_EXTLINUX=y
CONFIG_BOOTSTD_DEFAULTS=y
CONFIG_USE_DEFAULT_ENV_FILE=n
CONFIG_DEFAULT_ENV_FILE=""
'';
defconfig = "mt7988a_bpir4_sd_defconfig";
extraMeta.platforms = ["aarch64-linux"];
filesToInstall = ["*.bin"];
};
in
armTrustedFirmwareMTK