View Single Post
Posts: 2,225 | Thanked: 3,822 times | Joined on Jun 2010 @ Florida
#97
I do like my code so far though for a simple shell prompt, and if someone just wrote some if/then checks to see if the kernel was a power kernel version with fbcon built-in as a loadable module, and that the required command line tools and files were all available where indicated in the code, then it could be stuck inside the /sbin/preinit on pali's repo.

Code:
        modprobe fbcon
        printf "Press any key to get a shell.../n"
        for q in 4 3 2 1 0
        do
         printf "$q"
         if (read -n 1 -t 1)
         then
          printf "\b\b"
          insmod $MODULE_PATH/led-class.ko
          insmod $MODULE_PATH/leds-lp5523.ko
          insmod $MODULE_PATH/omap_wdt.ko
          insmod $MODULE_PATH/twl4030_wdt.ko
          sleep 1
          for p in /sys/bus/platform/devices/*_wdt/misc:*; do
           n=`basename $p | sed "s/.*://"`
           rm -f /dev/$n
           mknod /dev/$n c `cat $p/dev | sed "s/:/ /g"`
          done
          for i in 1 2 3 4 5 6; do
           echo 25 > /sys/class/leds/lp5523\:kb$i/brightness
          done
          watchdog -t 20 /dev/watchdog
          watchdog -t 20 /dev/twl4030_wdt
          loadkmap < /etc/nokia-n900.kmap
          sh
          killall watchdog
          break
         fi
         printf "\b"
        done
In the long term, we'd probably want a settings option somewhere (maybe even CAL area if/when that's reverse-engineered properly) since if this is going to be a replacement package for getbootstate we'd probably want there to be some way to enable the shell and/or possibly-built-in-menu as a settings option. That way, the feature can be built-in to /sbin/preinit so that it's there as a safety option, but doesn't have to run by default.

P.S. Pali, I subscribed myself to that launchpad branch of open source getbootstate you have.
 

The Following 4 Users Say Thank You to Mentalist Traceur For This Useful Post: