2024-01-17 18:22:30 +01:00
|
|
|
|
final: prev:
|
|
|
|
|
|
|
|
|
|
# Changes to packages from nixpkgs
|
|
|
|
|
|
|
|
|
|
{
|
|
|
|
|
opensbi = prev.opensbi.overrideAttrs (old: {
|
|
|
|
|
makeFlags = old.makeFlags ++ [
|
|
|
|
|
# Build OpenSBI without compressed instructions
|
2024-01-25 15:36:39 +01:00
|
|
|
|
"PLATFORM_RISCV_ISA=rv64g"
|
2024-01-17 18:22:30 +01:00
|
|
|
|
# Check with: riscv64-unknown-elf-objdump -d -M no-aliases rotate
|
|
|
|
|
];
|
|
|
|
|
});
|
2024-01-18 14:13:22 +01:00
|
|
|
|
|
|
|
|
|
# Fix GCC 13 format-overflow warning/error:
|
|
|
|
|
# ../src/shared/install.c:444:64: error: ‘%s’ directive argument is null [-Werror=format-overflow=]
|
|
|
|
|
# 444 | err = log_error_errno(changes[i].type, "Failed to %s unit, unit %s does not exist.",
|
|
|
|
|
# | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
|
|
|
|
systemd = prev.systemd.overrideAttrs (old: {
|
|
|
|
|
CFLAGS = "-Wno-error=format-overflow";
|
|
|
|
|
});
|
2024-01-18 15:59:51 +01:00
|
|
|
|
|
|
|
|
|
qemu = prev.qemu.override { rutabagaSupport = false; };
|
2024-01-18 17:58:00 +01:00
|
|
|
|
|
|
|
|
|
uboot-custom = prev.ubootQemuRiscv64Smode.override {
|
2024-01-19 14:29:23 +01:00
|
|
|
|
# Override preboot to set 'bootcmd' directly to the kernel address in RAM
|
2024-01-18 17:58:00 +01:00
|
|
|
|
extraConfig = ''
|
2024-01-19 14:29:23 +01:00
|
|
|
|
CONFIG_PREBOOT="setenv fdt_addr ''${fdtcontroladdr}; fdt addr ''${fdtcontroladdr}; setenv bootcmd booti ''${kernel_addr_r} - ''${fdtcontroladdr};"
|
2024-01-19 16:31:53 +01:00
|
|
|
|
CONFIG_RISCV_ISA_C=n
|
2024-01-18 17:58:00 +01:00
|
|
|
|
'';
|
2024-01-19 16:32:40 +01:00
|
|
|
|
# Also include debug u-boot
|
|
|
|
|
filesToInstall = ["u-boot.bin" "u-boot"];
|
2024-01-18 17:58:00 +01:00
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
opensbi-uboot = prev.opensbi.overrideAttrs (old: {
|
|
|
|
|
makeFlags = old.makeFlags ++ [
|
|
|
|
|
# Build OpenSBI without compressed instructions
|
2024-01-25 15:36:39 +01:00
|
|
|
|
"PLATFORM_RISCV_ISA=rv64g"
|
2024-01-18 17:58:00 +01:00
|
|
|
|
# Check with: riscv64-unknown-elf-objdump -d -M no-aliases rotate
|
|
|
|
|
"FW_PAYLOAD_PATH=${final.uboot-custom}/u-boot.bin"
|
|
|
|
|
];
|
|
|
|
|
});
|
2024-01-19 12:32:06 +01:00
|
|
|
|
|
|
|
|
|
linuxPackagesCustom = prev.linuxPackagesFor (prev.linux.override {
|
2024-01-22 13:35:21 +01:00
|
|
|
|
# Don't use a compiler without compressed instructions, let the kernel
|
|
|
|
|
# configure the -march and -mabi arguments.
|
|
|
|
|
stdenv = prev.stdenv;
|
2024-01-19 12:32:06 +01:00
|
|
|
|
structuredExtraConfig = with prev.lib.kernel; {
|
|
|
|
|
KEXEC = yes;
|
|
|
|
|
SERIAL_8250_DW = yes;
|
|
|
|
|
PINCTRL_STARFIVE = yes;
|
|
|
|
|
|
|
|
|
|
# Doesn't build as a module
|
|
|
|
|
DW_AXI_DMAC_STARFIVE = yes;
|
|
|
|
|
|
|
|
|
|
# stmmac hangs when built as a module
|
|
|
|
|
#PTP_1588_CLOCK = yes;
|
|
|
|
|
#STMMAC_ETH = yes;
|
|
|
|
|
#STMMAC_PCI = yes;
|
|
|
|
|
|
|
|
|
|
# For qemu
|
|
|
|
|
BLOCK = yes;
|
|
|
|
|
BLK_DEV = yes;
|
|
|
|
|
DEVTMPFS = yes;
|
|
|
|
|
VIRTIO_MENU = yes;
|
|
|
|
|
VIRTIO_BLK = yes;
|
|
|
|
|
|
|
|
|
|
# For 9P: https://wiki.qemu.org/Documentation/9psetup
|
|
|
|
|
NET_9P = yes;
|
|
|
|
|
NET_9P_VIRTIO = yes;
|
|
|
|
|
NET_9P_DEBUG = yes;
|
|
|
|
|
"9P_FS" = yes;
|
|
|
|
|
"9P_FS_POSIX_ACL" = yes;
|
|
|
|
|
PCI = yes;
|
|
|
|
|
VIRTIO_PCI = yes;
|
|
|
|
|
PCI_HOST_GENERIC = yes;
|
2024-01-19 16:31:53 +01:00
|
|
|
|
|
|
|
|
|
RISCV_ISA_C = no;
|
2024-01-22 13:35:21 +01:00
|
|
|
|
NONPORTABLE = yes;
|
|
|
|
|
EFI = no;
|
2024-01-19 12:32:06 +01:00
|
|
|
|
};
|
|
|
|
|
});
|
2024-01-17 18:22:30 +01:00
|
|
|
|
}
|