From e26cb2b3c276a50eaca3dab9f51ca61ec15d5fa2 Mon Sep 17 00:00:00 2001 From: Arnout Engelen Date: Fri, 20 Dec 2024 23:57:31 +0100 Subject: [PATCH] more WiP --- modules/outputs/tftpboot.nix | 18 +++--------------- pkgs/kernel/default.nix | 5 +++-- pkgs/kernel/phram-always-memremap.patch | 20 ++++++++++++++++++++ 3 files changed, 26 insertions(+), 17 deletions(-) create mode 100644 pkgs/kernel/phram-always-memremap.patch diff --git a/modules/outputs/tftpboot.nix b/modules/outputs/tftpboot.nix index 26b1019f..f8f03c26 100644 --- a/modules/outputs/tftpboot.nix +++ b/modules/outputs/tftpboot.nix @@ -97,7 +97,7 @@ in { # decompression code will assume that any memory after the # end of the kernel is free - dtbStart=$(($rootfsStart + $rootfsSize)) + imageStart=$(($rootfsStart + $rootfsSize)) ${if cfg.compressRoot then '' lzma -z9cv ${o.rootfs} > rootfs.lz @@ -124,7 +124,7 @@ in { fdtput -p -t lx dtb /reserved-memory/$node reg $ac_prefix $(hex $rootfsStart) $sz_prefix $(hex $rootfsSize) fdtput -p dtb /reserved-memory/$node no-map - cmd="liminix ${cmdline} mtdparts=phram0:''${rootfsSize}(rootfs) phram.phram=phram0,''${rootfsStart},''${rootfsSize},${toString config.hardware.flash.eraseBlockSize} root=/dev/fit0"; + cmd="liminix ${cmdline} mtdparts=phram0:''${rootfsSize}(rootfs) phram.phram=phram0,''${rootfsStart},''${rootfsSize},${toString config.hardware.flash.eraseBlockSize} root=/dev/mtdblock0"; #cmd="liminix ${cmdline}" fdtput -t s dtb /chosen ${config.boot.commandLineDtbNode} "$cmd" @@ -148,22 +148,10 @@ cat << _VARS >> mkimage.its data = /incbin/("./dtb"); arch = "${arch}"; }; - ramdisk-1 { - description = "${arch} Liminix rootfs"; - data = /incbin/("./rootfs"); - type = "ramdisk"; - arch = "${arch}"; - os = "linux"; - }; - }; - configurations { - config-1 { - ramdisk = "ramdisk-1"; - }; }; }; _VARS - mkimage -f mkimage.its kernel.uimage + mkimage -f mkimage.its image tftpcmd="tftpboot $(hex $imageStart) result/image " bootcmd="bootm $(hex $imageStart)" diff --git a/pkgs/kernel/default.nix b/pkgs/kernel/default.nix index 879a785b..647eb58a 100644 --- a/pkgs/kernel/default.nix +++ b/pkgs/kernel/default.nix @@ -61,8 +61,9 @@ stdenv.mkDerivation rec { patches = [ ./cmdline-cookie.patch ./mips-malta-fdt-from-bootloader.patch - ] ++ lib.optional (lib.versionOlder version "5.18.0") - ./phram-allow-cached-mappings.patch; + ./phram-always-memremap.patch + ];# ++ lib.optional (lib.versionOlder version "5.18.0") + #./phram-allow-cached-mappings.patch # this is here to work around what I think is a bug in nixpkgs # packaging of ncurses: it installs pkg-config data files which diff --git a/pkgs/kernel/phram-always-memremap.patch b/pkgs/kernel/phram-always-memremap.patch new file mode 100644 index 00000000..46b78e16 --- /dev/null +++ b/pkgs/kernel/phram-always-memremap.patch @@ -0,0 +1,20 @@ +--- a/drivers/mtd/devices/phram.c 2024-12-20 23:42:19.248462526 +0100 ++++ b/drivers/mtd/devices/phram.c 2024-12-20 23:41:11.344218259 +0100 +@@ -85,7 +85,7 @@ + { + void *addr = NULL; + +- if (phram->cached) ++ if (phram->cached || true) + addr = memremap(start, len, MEMREMAP_WB); + else + addr = (void __force *)ioremap(start, len); +@@ -101,7 +101,7 @@ + { + void *addr = phram->mtd.priv; + +- if (phram->cached) { ++ if (phram->cached || true) { + memunmap(addr); + return; + }