View Single Post
Estel's Avatar
Posts: 5,028 | Thanked: 8,613 times | Joined on Mar 2011
#1328
For backupmenu-less fsck on device (be sure to have kernel-power for framebuffer, and latest cssu-thumg/testing installed, or blocker bug in fsck will kill your filesysytem!), add this:

Code:
        # Recovery shell
        printf "Press any key to get a shell.../n"
        for q in 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
...after line 31:
Code:
mkdir /tmp/dev
... of /sbin/preinit. Then, download .tar from this post's attachement, cd to / (as root), and unpack it.

After reboot, just after u-boot, bash any random button - you will enter the most early Maemo recovery shell in existence (so early, that you don't even have /dev/mmcblk0 assigned, amongst other things ). Keyboard mapping works thanks to file from this attachement (keyboard is mapped exactly as in backupmenu's recovery shell, so shift+space = tab, etc).

Now, you can run:
Code:
/udev-start.sh
... (ignore any errors) - you will get /dev/ things populated.

From now, you can fsck /dev/mmcblk0p2 -f -p or, basically, do whatever you want. Root (ubifs) is mounted, so it is good idea to save logs, for example via fsck /dev/mmcblk0p2 -f -p > /var/log/fsck.log. If you get "unexpected inconsistedncy!" message from fsck, do fsck /dev/mmcblk0p2 -f -y >> /var/log/fsck.log afterwards. Later, from within Maemo, you can inspect that log and see which files got nuked by filesystem errors, and reinstall approriate packages (the ones owning those files), if necessary.

Or you can play a little and re-create Maemo's boot process, line by line, if you feel fancy

Pros as compared to backupmenu - works even in situation, when backupmenu gest broken, or something miles before it fails. In fact, if you can get past u-boot, this recovery shell will work, period (not that it need u-boot to work, BTW). It have less dependencies and works earlier than Pali's recovery shell from extras (-something), too.

All credits to Mentalist Traceur. I just bundled /udev-start.sh, as I'm a lazy bastard like that. BTW, my probably-will-never-get-released backupmenu CLI replacement is based on above setup.

Cheers,
/Estel
Attached Files
File Type: tar recovery-shell-helper.tar (4.0 KB, 70 views)
__________________
N900's aluminum backcover / body replacement
-
N900's HDMI-Out
-
Camera cover MOD
-
Measure battery's real capacity on-device
-
TrueCrypt 7.1 | ereswap | bnf
-
Hardware's mods research is costly. To support my work, please consider donating. Thank You!

Last edited by Estel; 2014-05-16 at 11:00.
 

The Following 6 Users Say Thank You to Estel For This Useful Post: