Problem: make system behaviour dependent on keys pressed at power-on
Solution: in U-Boot you can define one or more keys or key combinations and commands which are
executed when these keys are pressed at power-on:
-
"magic_keys" (EV) - List of characters for keys; for example:
=> setenv magic_keys 0123CB*
-
"key_magic_?_" (EV) - Key code or list of key codes for this action;
scanned in the order as listed in magic_keys; for example:
=> setenv key_magic0 3a+3b
=> setenv key_magic1 3c
=> setenv key_magic2 4a
=> setenv key_magic3 4c+51
=> setenv key_magicC 3a+4a+5a
=> setenv key_magicB 52+53
=> setenv key_magic* 55+56
-
"key_cmd?" (EV) - Action to be performed when corresponding key(s) are pressed; for example:
=> setenv key_cmd0 setenv bootdelay 10
=> setenv key_cmd1 setenv addcons 'console=ttyS0,${baudrate}'
=> setenv key_cmd2 setenv memtest on
=> setenv key_cmd3 setenv bootcmd run old_version
=> setenv key_cmdC setenv bootcmd run recovery
=> setenv key_cmdB setenv bootcmd run usb_update
=> setenv key_cmd* setenv bootcmd run demo_mode
Example: after a software update, the user can select to boot the old software version
("run old_version")
by holding the keys with keycodes "4c" and "51" at power-on.