自定义组合键进入u-boot
原本u-boot是nand版的,现在用的是emmc板,有些功能又得重来一遍,例如u-boot组合键,预防意外进入u-boot。当时忘记怎么搞的了,没有记录,今天重新操作一遍,并记录,以备后用。
u-boot版本号:2013.01.01
1. 打开command的man.c,找到int abortboot(int bootdelay)函数
2.
将按下任意键的提示信息改为ctrl+q/Q。
if (bootdelay >= 0)
printf("Hit any key to stop autoboot: %2d ", bootdelay);
改成
if (bootdelay >= 0)
printf("Hit 'ctrl+q/Q' to stop autoboot: %2d ", bootdelay);
3. 将任意键判断条件改为需要的组合键,其中将调用到getc()函数,另外组合键ctrl+q的键值为0x11(17)
if (tstc()) {/* we got a key press*/
(void) getc(); /* consume input*/
puts ("\b\b\b 0");
abort = 1;
/* don't auto boot */
改成
if (tstc()) {/* we got a key press*/
if(getc()==17){
abort = 1;
/* don't auto boot */
bootdelay = 0;/* no more delay*/
4. 编译完成即可。
5. 引申,亦可以做得复杂点,例如需要连续输入一个密码才能进入u-boot,也是可行的,自行发挥了。