If you don't want to use a monitor do this to use a serial cable on a pi4:
echo 'raspberry' | openssl passwd -6 -stdin | awk '{print "pi:"$0}' > /path/to/bootfs/userconf.txt echo -e "uart_2ndstage=1\nenable_uart=1" >> /path/to/bootfs/config.txt