From 9ed8f812c8e5c767563bcf0c78024412cfb00566 Mon Sep 17 00:00:00 2001 From: Rodrigo Arias Mallo Date: Tue, 9 Jul 2024 18:21:33 +0200 Subject: [PATCH] Make our own init script The problem with the Stage 1 script is that is spawning another tee process to forward the output to the console, but this is not required. So let's only keep the memtool running by creating our own init script. --- lagarto-ox.nix | 25 ++++++++++++++++--------- 1 file changed, 16 insertions(+), 9 deletions(-) diff --git a/lagarto-ox.nix b/lagarto-ox.nix index ab96e84..6b51268 100644 --- a/lagarto-ox.nix +++ b/lagarto-ox.nix @@ -80,6 +80,20 @@ compressor = "gzip"; kernelModules = [ ]; + # Custom init script + extraFiles."/init2".source = pkgs.writeScript "init2" '' + #!${config.system.build.extraUtils}/bin/ash + + set -x + + export PATH=${config.system.build.extraUtils}/bin + + memtool $((64 * 1024)) + + # Unlikely to reach this point + exec /init + ''; + # Add the csrtool to the initrd so we can change the # in-order/out-of-order, and memtool to stress the memory. extraUtilsCommands = '' @@ -91,14 +105,7 @@ # dead. Monitor from the host with: # while [ 1 ]; do xxd -s $((0x1bfff0000 - 0x60000000)) \ # -l 4 /dev/qdma34000-MM-1; sleep 0.2; done - preDeviceCommands = - # Run our memtool to hang the kernel here. Set the maximum block - # size to 64K. - '' - memtool $((64 * 1024)) - '' - + - '' + preDeviceCommands = '' echo "Creating a heartbeat counter at 0x1bfff0000" sh -c 'hb=0; while [ 1 ]; do let hb=$hb+1; devmem 0x1bfff0000 32 $hb; done' & '' @@ -272,7 +279,7 @@ # tp_printk write ftrace events to console # trace_buf_size=1M set ftrace buffer to 1M # - setenv bootargs "root=/dev/ram0 loglevel=7 debug rw earlycon=sbi console=hvc0 init=${init}" + setenv bootargs "root=/dev/ram0 loglevel=7 debug rw earlycon=sbi console=hvc0 rdinit=/init2 init=${init}" EOF