title: u-boot select boot partition based on GPIO state
body: <p>I'm developing a recovery mechanism on a embedded system. I want to boot into recovery mode if user pressed a GPIO button. Recovery mode means selecting different kernel and root partition than usual. I got stuck on using gpio value in conditional command. If I write <code>if gpio input 20; then cmd; fi</code> <code>cmd</code> will always run because gpio returns error status not the value of GPIO. How can I get the value?</p>
  
  <p>Is it feasible to use U-Boot commands to implement boot selection (I need to blink LEDs for 15s and if the user presses the button for at least 5s then switch to recovery). Would it be easier to implement this logic in C code? If so where to look and are there any examples?</p>
  
  <p>In general providing recovery system seems like a common task for an embedded engineer. What are the best practices in this scenario? What is the most common way of implementing this? I could not find any help or guidelines on the web.</p>