日志
uboot指定按键进入uboot
2017-09-14 17:59
uboot源码中提供的进入uboot命令行的方式为输入任意键。我想将任意键换成Esc键。本次促改使用的是uboot.2012
修改方法: 1、修改common/main.c 或者 find .|xargs grep -ri ‘Hit any key’ 2、代码修改 [backcolor=rgba(128, 128, 128, 0.05)] static[backcolor=rgba(128, 128, 128, 0.05)] [backcolor=rgba(128, 128, 128, 0.05)]int[backcolor=rgba(128, 128, 128, 0.05)] __abortboot([backcolor=rgba(128, 128, 128, 0.05)]int[backcolor=rgba(128, 128, 128, 0.05)] bootdelay) [backcolor=rgba(128, 128, 128, 0.05)]{ [backcolor=rgba(128, 128, 128, 0.05)] int[backcolor=rgba(128, 128, 128, 0.05)] [backcolor=rgba(128, 128, 128, 0.05)]abort[backcolor=rgba(128, 128, 128, 0.05)] = [backcolor=rgba(128, 128, 128, 0.05)]0[backcolor=rgba(128, 128, 128, 0.05)]; [backcolor=rgba(128, 128, 128, 0.05)]unsigned[backcolor=rgba(128, 128, 128, 0.05)] [backcolor=rgba(128, 128, 128, 0.05)]long[backcolor=rgba(128, 128, 128, 0.05)] ts; [backcolor=rgba(128, 128, 128, 0.05)]#ifdef CONFIG_MENUPROMPT [backcolor=rgba(128, 128, 128, 0.05)][backcolor=rgba(128, 128, 128, 0.05)]printf[backcolor=rgba(128, 128, 128, 0.05)](CONFIG_MENUPROMPT); [backcolor=rgba(128, 128, 128, 0.05)]#else [backcolor=rgba(128, 128, 128, 0.05)][backcolor=rgba(128, 128, 128, 0.05)]// printf("Hit any key to stop autoboot: %2d ", bootdelay); [backcolor=rgba(128, 128, 128, 0.05)][backcolor=rgba(128, 128, 128, 0.05)]printf[backcolor=rgba(128, 128, 128, 0.05)]([backcolor=rgba(128, 128, 128, 0.05)]"Press 'ctrl+q/Q' to stop autoboot: %2d "[backcolor=rgba(128, 128, 128, 0.05)], bootdelay); [backcolor=rgba(128, 128, 128, 0.05)]#endif [backcolor=rgba(128, 128, 128, 0.05)][backcolor=rgba(128, 128, 128, 0.05)]/* [backcolor=rgba(128, 128, 128, 0.05)]* Check if key already pressed [backcolor=rgba(128, 128, 128, 0.05)]*/ [backcolor=rgba(128, 128, 128, 0.05)][backcolor=rgba(128, 128, 128, 0.05)]if[backcolor=rgba(128, 128, 128, 0.05)] (tstc()) { [backcolor=rgba(128, 128, 128, 0.05)]/* we got a key press *[backcolor=rgba(128, 128, 128, 0.05)]/ [backcolor=rgba(128, 128, 128, 0.05)]([backcolor=rgba(128, 128, 128, 0.05)]void[backcolor=rgba(128, 128, 128, 0.05)]) getc(); [backcolor=rgba(128, 128, 128, 0.05)]/* consume input */ [backcolor=rgba(128, 128, 128, 0.05)][backcolor=rgba(128, 128, 128, 0.05)]puts[backcolor=rgba(128, 128, 128, 0.05)]([backcolor=rgba(128, 128, 128, 0.05)]"\b\b\b 0"[backcolor=rgba(128, 128, 128, 0.05)]); [backcolor=rgba(128, 128, 128, 0.05)]abort[backcolor=rgba(128, 128, 128, 0.05)] = [backcolor=rgba(128, 128, 128, 0.05)]1[backcolor=rgba(128, 128, 128, 0.05)]; [backcolor=rgba(128, 128, 128, 0.05)]/* don't auto boot */ [backcolor=rgba(128, 128, 128, 0.05)]}[backcolor=rgba(128, 128, 128, 0.05)]while[backcolor=rgba(128, 128, 128, 0.05)] ((bootdelay > [backcolor=rgba(128, 128, 128, 0.05)]0[backcolor=rgba(128, 128, 128, 0.05)]) && (![backcolor=rgba(128, 128, 128, 0.05)]abort[backcolor=rgba(128, 128, 128, 0.05)])) [backcolor=rgba(128, 128, 128, 0.05)] { [backcolor=rgba(128, 128, 128, 0.05)]--bootdelay;[backcolor=rgba(128, 128, 128, 0.05)]/* delay 1000 ms */ [backcolor=rgba(128, 128, 128, 0.05)]ts = get_timer([backcolor=rgba(128, 128, 128, 0.05)]0[backcolor=rgba(128, 128, 128, 0.05)]); [backcolor=rgba(128, 128, 128, 0.05)]do[backcolor=rgba(128, 128, 128, 0.05)] { [backcolor=rgba(128, 128, 128, 0.05)]if[backcolor=rgba(128, 128, 128, 0.05)] (tstc()) [backcolor=rgba(128, 128, 128, 0.05)]{ [backcolor=rgba(128, 128, 128, 0.05)]/* we got a key press */ [backcolor=rgba(128, 128, 128, 0.05)][backcolor=rgba(128, 128, 128, 0.05)]if[backcolor=rgba(128, 128, 128, 0.05)](2[backcolor=rgba(128, 128, 128, 0.05)]7[backcolor=rgba(128, 128, 128, 0.05)] == getc()){ [backcolor=rgba(128, 128, 128, 0.05)]abort[backcolor=rgba(128, 128, 128, 0.05)] = [backcolor=rgba(128, 128, 128, 0.05)]1[backcolor=rgba(128, 128, 128, 0.05)]; [backcolor=rgba(128, 128, 128, 0.05)]/* don't auto boot */ [backcolor=rgba(128, 128, 128, 0.05)]bootdelay = [backcolor=rgba(128, 128, 128, 0.05)]0[backcolor=rgba(128, 128, 128, 0.05)]; [backcolor=rgba(128, 128, 128, 0.05)]/* no more delay */ [backcolor=rgba(128, 128, 128, 0.05)][backcolor=rgba(128, 128, 128, 0.05)]# ifdef CONFIG_MENUKEY [backcolor=rgba(128, 128, 128, 0.05)]menukey = getc(); [backcolor=rgba(128, 128, 128, 0.05)]# else [backcolor=rgba(128, 128, 128, 0.05)]([backcolor=rgba(128, 128, 128, 0.05)]void[backcolor=rgba(128, 128, 128, 0.05)]) getc(); [backcolor=rgba(128, 128, 128, 0.05)]/* consume input */ [backcolor=rgba(128, 128, 128, 0.05)][backcolor=rgba(128, 128, 128, 0.05)]# endif [backcolor=rgba(128, 128, 128, 0.05)][backcolor=rgba(128, 128, 128, 0.05)]break[backcolor=rgba(128, 128, 128, 0.05)]; [backcolor=rgba(128, 128, 128, 0.05)]} [backcolor=rgba(128, 128, 128, 0.05)]} [backcolor=rgba(128, 128, 128, 0.05)]udelay([backcolor=rgba(128, 128, 128, 0.05)]10000[backcolor=rgba(128, 128, 128, 0.05)])[backcolor=rgba(128, 128, 128, 0.05)]; [backcolor=rgba(128, 128, 128, 0.05)]} [backcolor=rgba(128, 128, 128, 0.05)]while[backcolor=rgba(128, 128, 128, 0.05)] (![backcolor=rgba(128, 128, 128, 0.05)]abort[backcolor=rgba(128, 128, 128, 0.05)] && get_timer(ts) < [backcolor=rgba(128, 128, 128, 0.05)]1000[backcolor=rgba(128, 128, 128, 0.05)]); [backcolor=rgba(128, 128, 128, 0.05)]printf[backcolor=rgba(128, 128, 128, 0.05)]([backcolor=rgba(128, 128, 128, 0.05)]"\b\b\b%2d "[backcolor=rgba(128, 128, 128, 0.05)], bootdelay)[backcolor=rgba(128, 128, 128, 0.05)]; [backcolor=rgba(128, 128, 128, 0.05)]} [backcolor=rgba(128, 128, 128, 0.05)]putc([backcolor=rgba(128, 128, 128, 0.05)]'\n'[backcolor=rgba(128, 128, 128, 0.05)]); [backcolor=rgba(128, 128, 128, 0.05)]return[backcolor=rgba(128, 128, 128, 0.05)] [backcolor=rgba(128, 128, 128, 0.05)]abort[backcolor=rgba(128, 128, 128, 0.05)]; [backcolor=rgba(128, 128, 128, 0.05)]} |
下一篇: 无
上一篇: 无