-
Notifications
You must be signed in to change notification settings - Fork 3
Open
Description
Made a separate issue tangential to #40
Speaking of Nix on fml13v03, @RossComputerGuy have you had any progress on your part? ive been trying to cross compile an sd-image for it using the fml13v03-opensbi, fml13v03-linux, fml13v03-uboot, and fml13v03-firmware repos. for some reason DC-DeepComputing decided to remove the fml13v03 repo outright, so i cant even just build from that repo and use the resulting kernel and bootchain to build a nixos rootfs.
for context this is my flake. dont mind the bad sha's because i never got that far, and i completely gave up on the opensbi stage.
description = "NixOS for Framework Laptop 13 RISC-V Edition (EIC7702)";
inputs = {
nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable";
systems.url = "github:nix-systems/x86_64-linux";
flake-utils.url = "github:numtide/flake-utils";
flake-utils.inputs.systems.follows = "systems";
};
outputs = { self, nixpkgs, flake-utils, ... }:
flake-utils.lib.eachDefaultSystem (system:
let
pkgs = import nixpkgs {
inherit system;
crossSystem = {
config = "riscv64-unknown-linux-gnu";
system = "riscv64-linux";
};
};
buildPkgs = import nixpkgs { inherit system; };
fml13v03-linux-src = buildPkgs.fetchFromGitHub {
owner = "DC-DeepComputing";
repo = "fml13v03_linux";
rev = "fml13v03-6.6.92";
hash = "sha256-RvZapBfQAokxVMNT2VU0tJqeI4LxMQTs1n+z74mR8XU=";
};
fml13v03-uboot-src = buildPkgs.fetchFromGitHub {
owner = "DC-DeepComputing";
repo = "fml13v03_u-boot";
rev = "fml13v03-6.6.18";
hash = "sha256-cgVjGXityxsnqs/onLJ0E6tlLI4YH1LALUA/rM+LPUg=";
};
fml13v03-opensbi-src = buildPkgs.fetchFromGitHub {
owner = "DC-DeepComputing";
repo = "fml13v03_opensbi";
rev = "fml13v03-6.6.18";
hash = "sha256-RvZapBfQAokxVMNT2VU0tJqeI4LxMQTs1n+z74mR8XU=";
};
fml13v03-secboot-fw-src = buildPkgs.fetchFromGitHub {
owner = "DC-DeepComputing";
repo = "fml13v03_secboot_fw";
rev = "main";
hash = "sha256-AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA=";
};
opensbi = pkgs.stdenv.mkDerivation {
pname = "opensbi-fml13v03";
version = "fml13v03";
src = fml13v03-opensbi-src;
nativeBuildInputs = with buildPkgs; [
dtc
python3
];
makeFlags = [
"CROSS_COMPILE=riscv64-unknown-linux-gnu-"
"PLATFORM=eswin/eic770x"
"PLATFORM_RISCV_XLEN=64"
];
installPhase = ''
runHook preInstall
mkdir -p $out/share/opensbi
cp -r build/platform/eswin/eic770x/firmware/* $out/share/opensbi/
runHook postInstall
'';
dontFixup = true;
};
uboot = pkgs.stdenv.mkDerivation {
pname = "uboot-fml13v03";
version = "fml13v03";
src = fml13v03-uboot-src;
depsBuildBuild = with buildPkgs; [
buildPackages.stdenv.cc
];
nativeBuildInputs = with buildPkgs; [
bison
flex
bc
dtc
openssl
swig
ncurses
python3
python3Packages.setuptools
(python3.withPackages (ps: with ps; [ setuptools ]))
];
buildInputs = with buildPkgs; [
openssl
ncurses
];
configurePhase = ''
runHook preConfigure
make CROSS_COMPILE=riscv64-unknown-linux-gnu- dt_name=eic7702-deepcomputing-fml13v03 board_name=FML13V03 deepcomputing-fml13v03_defconfig
runHook postConfigure
'';
buildPhase = ''
runHook preBuild
make CROSS_COMPILE=riscv64-unknown-linux-gnu- -j$NIX_BUILD_CORES
runHook postBuild
'';
installPhase = ''
runHook preInstall
mkdir -p $out/share/u-boot
cp u-boot.bin $out/share/u-boot/ || true
cp u-boot.itb $out/share/u-boot/ || true
cp u-boot-spl.bin $out/share/u-boot/ || true
cp -r arch/riscv/dts/*.dtb $out/share/u-boot/ || true
runHook postInstall
'';
dontFixup = true;
};
firmware = buildPkgs.stdenv.mkDerivation {
pname = "firmware-fml13v03";
version = "fml13v03";
src = fml13v03-secboot-fw-src;
installPhase = ''
runHook preInstall
mkdir -p $out/lib/firmware
cp -r * $out/lib/firmware/ || true
runHook postInstall
'';
dontBuild = true;
dontFixup = true;
};
linuxPackages = pkgs.linuxPackagesFor (pkgs.linux.override {
src = fml13v03-linux-src;
version = "6.6.92";
modDirVersion = "6.6.92";
structuredExtraConfig = with pkgs.lib.kernel; {
RISCV = yes;
SERIAL_8250 = yes;
SERIAL_8250_CONSOLE = yes;
MMC = yes;
MMC_SDHCI = yes;
USB = yes;
USB_XHCI_HCD = yes;
NETDEVICES = yes;
ETHERNET = yes;
OF = yes;
FW_LOADER = yes;
};
extraMeta.branch = "6.6";
});
in rec {
packages.default = packages.sd-image;
packages.sd-image = (import "${nixpkgs}/nixos" {
configuration = { config, lib, pkgs, ... }: {
imports = [
"${nixpkgs}/nixos/modules/installer/sd-card/sd-image.nix"
];
boot = {
kernelPackages = linuxPackages;
loader = {
grub.enable = false;
generic-extlinux-compatible.enable = true;
};
initrd.availableKernelModules = [
"mmc_block"
"usbhid"
"hid_generic"
];
kernelParams = [
"console=ttyS0,115200n8"
"earlycon=sbi"
"root=/dev/mmcblk0p2"
"rootwait"
"rw"
];
};
hardware = {
deviceTree = {
enable = true;
name = "eswin/eic7702-deepcomputing-fml13v03.dtb";
};
firmware = [ firmware ];
};
sdImage = {
compressImage = false;
populateFirmwareCommands = ''
cp ${uboot}/share/u-boot/u-boot.bin firmware/ || true
cp ${uboot}/share/u-boot/u-boot.itb firmware/ || true
'';
populateRootCommands = ''
mkdir -p ./files/boot
${config.boot.loader.generic-extlinux-compatible.populateCmd} -c ${config.system.build.toplevel} -d ./files/boot
'';
firmwareSize = 64;
};
users.users.nixos = {
isNormalUser = true;
password = "test123";
extraGroups = [ "wheel" "networkmanager" ];
};
security.sudo.wheelNeedsPassword = false;
services.openssh = {
enable = true;
settings.PermitRootLogin = "yes";
};
networking = {
hostName = "fml13v03";
useDHCP = lib.mkDefault true;
networkmanager.enable = true;
};
environment.systemPackages = with pkgs; [
vim
git
htop
wget
curl
];
nixpkgs.crossSystem = {
config = "riscv64-unknown-linux-gnu";
system = "riscv64-linux";
};
system.stateVersion = "24.11";
};
inherit system;
}).config.system.build.sdImage;
packages.uboot = uboot;
packages.firmware = firmware;
packages.kernel = linuxPackages.kernel;
devShells.default = buildPkgs.mkShell {
nativeBuildInputs = with buildPkgs; [
gcc
dtc
python3
bison
flex
bc
openssl
swig
ncurses
];
shellHook = ''
export CROSS_COMPILE=riscv64-unknown-linux-gnu-
export ARCH=riscv
echo "FML13V03 Development Shell"
'';
};
});
}```
Metadata
Metadata
Assignees
Labels
No labels