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 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. 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 = [ ]; kernelModules = [ ];
# Custom init script # Custom init script
extraFiles."/init2".source = pkgs.writeScript "init2" '' extraFiles = {
#!${config.system.build.extraUtils}/bin/ash "/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 "/preinit".source = pkgs.writeScript "preinit" ''
#mount -t tracefs nodev /tracing #!${config.system.build.extraUtils}/bin/ash
set -x
#cd /tracing export PATH=${config.system.build.extraUtils}/bin
#echo nop > current_tracer csrtool all-in-order
#echo 100 > max_graph_depth exec /init
#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
'';
# Add the csrtool to the initrd so we can change the # Add the csrtool to the initrd so we can change the
# in-order/out-of-order, and memtool to stress the memory. # in-order/out-of-order, and memtool to stress the memory.
@ -283,7 +276,10 @@
fdt set /memory@80000000 reg <0x0 0x80000000 0x0 0xc0000000> fdt set /memory@80000000 reg <0x0 0x80000000 0x0 0xc0000000>
# Set kernel bootcmd options. # 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: # NixOS interesting options:
# debug1 enable debug shell in stage 1 # debug1 enable debug shell in stage 1
# boot.trace enable set -x in stage 1 # boot.trace enable set -x in stage 1
@ -294,7 +290,7 @@
# tp_printk write ftrace events to console # tp_printk write ftrace events to console
# trace_buf_size=1M set ftrace buffer to 1M # 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 EOF