Enable systemd debug log and all-in-order

This commit is contained in:
Rodrigo Arias 2024-07-12 10:50:28 +02:00
parent 40def167f1
commit 8c2b28cf21
2 changed files with 28 additions and 24 deletions

View File

@ -1427,3 +1427,11 @@ clues by enabling the debug mode.
If a trap is being issued, we may be able to modify OpenSBI to print some
information to the serial console so we can understand what is going on.
In the meanwhile, let's try a simple test. We can enable debug output of systemd
with the following boot options:
systemd.log_level=debug systemd.log_target=console
We will also need to run `csrtool all-in-order` to arrive to systemd.

View File

@ -81,31 +81,24 @@
kernelModules = [ ];
# Custom init script
extraFiles."/init2".source = pkgs.writeScript "init2" ''
#!${config.system.build.extraUtils}/bin/ash
extraFiles = {
"/shell".source = pkgs.writeScript "shell" ''
#!${config.system.build.extraUtils}/bin/ash
set -x
set -x
export PATH=${config.system.build.extraUtils}/bin
export PATH=${config.system.build.extraUtils}/bin
ash
'';
#mkdir -p /tracing
#mount -t tracefs nodev /tracing
#cd /tracing
#echo nop > current_tracer
#echo 100 > max_graph_depth
#echo handle_page_fault > set_graph_function
#echo function_graph > current_tracer
#cd /
# Open an interactive shell
ash
memtool fill $((512 * 1024 * 1024))
# Unlikely to reach this point
exec /init
'';
"/preinit".source = pkgs.writeScript "preinit" ''
#!${config.system.build.extraUtils}/bin/ash
set -x
export PATH=${config.system.build.extraUtils}/bin
csrtool all-in-order
exec /init
'';
};
# Add the csrtool to the initrd so we can change the
# in-order/out-of-order, and memtool to stress the memory.
@ -283,7 +276,10 @@
fdt set /memory@80000000 reg <0x0 0x80000000 0x0 0xc0000000>
# Set kernel bootcmd options.
# rdinit=/init2 boot custom init script
# rdinit=/preinit boot custom preinit script
# Systemd options
# systemd.log_level=debug
# systemd.log_target=console
# NixOS interesting options:
# debug1 enable debug shell in stage 1
# boot.trace enable set -x in stage 1
@ -294,7 +290,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 systemd.log_level=debug systemd.log_target=console rdinit=/preinit init=${init}"
EOF