# static routines without external inputs

cat << EOF

#Print the defaults
setenv showdefs 'echo ""; echo "The following configuration values are defined:"; echo u_k_addr: \$u_k_addr; echo u_k_addr: \$u_k_addr; echo u_ramfs_addr: \$u_ramfs_addr; echo u_dtb_addr: \$u_dtb_addr; echo u_iodevs: \$u_iodevs; echo u_iodevs: \$u_iodevs; echo u_fs: \$u_fs; echo u_devpart: \$u_devpart; echo u_boot: \$u_boot; echo u_root: \$u_root; echo u_dtb: \$u_dtb; echo skip_dtb: \$skip_dtb (null means a dtb will be loaded); echo pass_dtb: \$pass_dtb (null means no bootarg passed); echo u_extraargs: \$u_extraargs'

# catcat: variable pointer conversion: input catin, output catout
setenv catcat setenv catout\;'setenv catX "setenv catout '\\\\\\\\\\\\\''\\$\\\$catin'\\\\\\\\\\\\\\''"' \; run catX

# Something failed.
setenv failed 'echo The last operation failed.; run help; run false'
setenv true test 1 = 1
setenv false test 1 = 0

# Some helpful ways of recovering
setenv graphical 'systemd_args="systemd.unit=graphical.target cma=64M"; echo "Will boot with graphical target (cma=64M)"'
setenv single 'systemd_args="systemd.unit=emergency.target"; opt_bootargs=""; echo "Will boot into single user mode"'
setenv rescue 'systemd_args="systemd.unit=rescue.target"; opt_bootargs=""; echo "Will boot into rescue mode"'
setenv debug 'systemd_args="earlyprintk systemd.log_level=debug systemd.log_target=kmsg log_buf_len=1M"; opt_bootargs=""; echo "Will boot with debug output"'
setenv normal 'systemd_args=""; opt_bootargs=\$saved_bootargs; echo "Will boot normally"'

# main menu
setenv menu 'echo; echo a-b-c main menu; echo ---------------; echo run clist: for a list of known board configurations.; echo run klist: for a list of kernels.; echo run dtblist: for a list of dtbs.; echo run single: for single user target on boot.; echo run rescue: for rescue target on boot.; echo run graphical: for graphical target on boot.; echo run debug: for verbose debug boot.; echo run normal: for default systemd boot target (default).; echo run showdefs: for current defaults.; echo boot or run bootcmd: boot with currently configured parameters.; echo ""; echo Enter command from the above list.; echo ""'
setenv help run menu

EOF

