# static routines without external inputs

cat << EOF

#Print the defaults
setenv showdefs 'echo ""; echo "The following configuration values are defined:"; run enum_defs'
setenv enum_defs 'run p_k_addr p_ramfs_addr p_dtb_addr p_dtb p_iodevs p_fs p_part p_boot p_root p_extraargs p_skip_dtb p_pass_dtb'
setenv p_k_addr 'echo u_k_addr: \$u_k_addr'
setenv p_ramfs_addr 'echo u_ramfs_addr: \$u_ramfs_addr'
setenv p_dtb_addr 'echo u_dtb_addr: \$u_dtb_addr '
setenv p_dtb 'echo u_dtb: \$u_dtb'
setenv p_iodevs 'echo u_iodevs: \$u_iodevs'
setenv p_fs 'echo u_fs: \$u_fs'
setenv p_part 'echo u_devpart: \$u_devpart'
setenv p_boot 'echo u_boot: \$u_boot'
setenv p_root 'echo u_root: \$u_root'
setenv p_extraargs 'echo u_extraargs: \$u_extraargs'
setenv p_skip_dtb 'echo skip_dtb: \$skip_dtb (null means a dtb will be loaded)'
setenv p_pass_dtb 'echo pass_dtb: \$pass_dtb (null means no bootarg passed)'

# 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 run 'menu_header menu_clist menu_klist menu_dtblist menu_showdefs menu_single menu_rescue menu_debug menu_graphical menu_normal menu_boot menu_footer'
setenv menu_header echo\; echo a-b-c main menu\; echo ---------------
setenv menu_clist echo clist: for a list of known board configurations.
setenv menu_klist echo klist: for a list of kernels.
setenv menu_dtblist echo dtblist: for a list of dtbs.
setenv menu_showdefs echo showdefs: for current defaults.
setenv menu_single echo single: for single user target on boot.
setenv menu_rescue echo rescue: for rescue target on boot.
setenv menu_graphical echo graphical: for graphical target on boot.
setenv menu_debug echo debug: for verbose debug boot.
setenv menu_normal echo normal: for default systemd boot target (default).
setenv menu_boot echo bootcmd: boot with currently configured parameters.
setenv menu_footer echo\; echo Type \\\\\'run option\\\\\' where option is from the above list.
setenv help run menu

EOF

