Reply
Thread Tools
Posts: 95 | Thanked: 66 times | Joined on Mar 2012
#1
What you get:
- Lots of space to install apps; by restoring from a hacked and modified N900 rootfs and optfs Backupmenu image.
- After having this applied, the N900 should still be usable in all normal ways 99% of the time (ie: install CSSU before or after, install any apps, install kernel-power before or after). Minimal precautions needed after.

Audience:
- To advanced N900 users (which refers to most of you) who may find a use for this hack.
- Please read each line in this post. If there are any lines that you do not understand or know how to execute after reading thru each line in this post, I do not recommend you proceeding further.

Assumptions:
- Most apps only install to /lib, /usr/bin, /usr/lib, /usr/share, and /opt. At least, those are always the largest folder in my device.

What actually happens:
- Summary: Scripts reorgs file system inside backupmenu archives one time, placing /lib, /usr/bin, /usr/lib & /usr/share on eMMC. Restoring from this modified Backupmenu archive will give you an OS that mostly stops installing to rootfs; app installs will all mostly go to optfs/eMMC (I'd say roughly more than 95% of the time).
- Details:
- Scripts attached to this post will untar your specified backupmenu archives to a work location, then..
- Reorg both rootfs and optfs in following manner -
- Moves /home/opt to a directory under /home/mnt (trace scripts for more details).
- Renames /lib to /lib-nand in rootfs.
- Renames /usr/bin to /usr/bin-nand in rootfs.
- Renames /usr/lib to /usr/lib-nand in rootfs.
- Renames /usr/share to /usr/share-nand in rootfs.
- Creates /lib in rootfs, links /lib-nand/* over.
- Creates /usr/bin in rootfs, links /usr/bin-nand/* over.
- Creates /usr/lib in rootfs, links /usr/lib-nand/* over.
- Creates /usr/share in rootfs, links /usr/share-nand/* over.
- Creates directories for /lib, /usr/bin, /usr/lib & /usr/share in optfs.
- For above folders in optfs, create symlinks to actual files from corresponding *-nand folders.
- Above symlinks are created only for files and links, not for directories.
- Above symlinks are created at every level of folders.
- Modifies /sbin/preinit, so that at boot time, mounts optfs, mount binds /lib, /usr/bin, /usr/lib & /usr/share from optfs to equivalents in rootfs.
- Previous lines cause /lib, /usr/bin, /usr/lib & /usr/share accessed from rootfs to actually refer to the ones in optfs after boot.
- Script then packages all above up back into normal Backupmenu archives.
- Produced Backupmenu archive can then be restored to your N900 to get an OS that uses very little rootfs space and leaves you with lots of space for apps install in optfs/eMMC.

Effects:
- Parts that remain on NAND/rootfs, will continue to load/run fast - and we want this as most that are already on rootfs are OS stuff that gets loaded everytime or very often.
- Parts that get installed in optfs/eMMC, will load just a bit slower - which is fine for most apps.
- I've tried having full rootfs/optfs on eMMC & it was quite slow for me.

Important note:
- Overwrites your /sbin/preinit file, but is mostly compatible with existing ones so far, before or after CSSU or kernel power.

Known issues:
- When screen is off, pressing power button doesn't wake N900 anymore.
- When screen is on, pressing power button brings up its menu after around 3 seconds delay. Can't idle N900 using this anymore.
- Alternative:
-- Open keyboard to wake N900 or use the side sliding power button.
-- Put a button on desktop that calls a script to make N900 sleep/idle.
-- Or use that same slide power button to put N900 to sleep/idle mode.
-- If someone fixes issue above, I'd love to know - private message me.
- At N900 shutdown, I didn't put anything extra to unmount optfs... Not sure if this would be an issue.

Testimony:
- I've had this since last year August with CSSU Stable & lotsa apps.
- I've just built a new image using CSSU Thumb and reinstalled many apps. So far, no prob.

Other notes:
- Your Backupmenu files will have potential of becoming huge if you install many apps. Mine's at 1.5GB currently. Side note to keep your N900 fast: Install apps that don't hog up memory (ie: plugins); Only install those that remain non-loaded until loaded, and stays unloaded after app termination.

Prerequisites:
- Backupmenu - Mandatory. Assumes you know how to use this.
- Rootsh - Mandatory. Assumes you know how to use this.
- Backupmenu rootfs and optfs archive of a fresh/clean PR1.3 image - this is the image that will be modified. Definition of fresh/clean image: Produce this image by flashing your N900 with stock PR1.3 root & optfs images. Then, immediately install Backupmenu & backup both root & optfs to produce this fresh/clean image.
- Backup backup backup your existing N900!!! Backup using Backupmenu, then tar up your entire MyDocs folder. Copy all backups OUT OF THE N900 device into your own hard disk. You may want to restore using backups if this hack doesn't suit your liking.

How:
1) In this example - In your existing N900 (fully loaded with tons of apps, or a freshly flashed one), there are fresh/clean Backupmenu N900 maemo PR1.3 images: /home/user/MyDocs/systemBackups/20130101-0000-rootfs.tar.gz & /home/user/MyDocs/systemBackups/20130101-0000-optfs.tar.gz (use corresponding file names in your case).
2) Ensure N900 used has Backupmenu & Rootsh installed.
3) Ensure there is space to use in /home/user (need enough to untar above Backupmenu images).
4) Open xterm, run sudo gainroot.
5) Place n900scripts-rootemmcpartial.tar into /home/user. Then do: cd /opt/usr/bin ; tar xf /home/user/n900scripts-rootemmcpartial.tar
6) Run /opt/usr/bin/N900bkmnutareditstart /home/user/MyDocs/systemBackups/20130101-0000-rootfs.tar.gz /home/user/MyDocs/systemBackups/20130101-0000-optfs.tar.gz
7) By now, /home/user/zfsroot & /home/user/zfsopt should exist, containing untarred Backupmenu images.
8) Run /opt/usr/bin/N900bkmnutareditoptfsmountreorg
9) Run /opt/usr/bin/N900bkmnutareditrootoneMMCallenable
10) Run /opt/usr/bin/N900bkmnutareditrootoneMMChalfdo # This takes a while.
11) Run /opt/usr/bin/N900bkmnutareditstop 20130101-0001-rootfs.tar.gz 20130101-0001-optfs.tar.gz # Produces output file here with slightly different names. This takes a while also.
12) By now, /home/user/20130101-0001-rootfs.tar.gz /home/user/20130101-0001-optfs.tar.gz would exist. Restoring these onto an existing N900 will produce a system that has part of root on eMMC (as described in "What you get"), and will overwrite many things in that existing N900.
13) Run cp /home/user/20130101-0001-rootfs.tar.gz /home/user/20130101-0001-optfs.tar.gz /home/user/MyDocs/systemBackups
14) Reboot with keyboard open to enter Backupmenu, restore both rootfs & optfs with 20130101-0001-rootfs.tar.gz & 20130101-0001-optfs.tar.gz.
15) Reboot N900 again, and you'll get an N900 with part of its root file system inside eMMC. You'll see a /lib-nand directory when you do cd /; ls. Also, /lib will be a symlink to /lib-nand.
16) Done.

Post-install:
- Recommended: After every CSSU update, as root, run N900rootoneMMCprtlharmonize.
- Also see end of Compatibility section. Basically, consider invoking all those N900rootoneMMCprtlsyssvcwrkarnd* commands as per instruction for every CSSU update.

Considerations - Designate specific apps to reside in NAND rootfs:
- Note: After step 15 in "How" section, most apps will get installed into eMMC. Some apps may be a bit slower to start as a result. Installing them into NAND rootfs first before Step 1 helps let them load up faster.
- In "How" section, when producing clean/fresh images in Step 1, first install apps required in the fresh/clean image.
- Then, follow Step 1 to Step 15 in "How" section normally.

Considerations - Producing fresh/clean image from CSSU thumb:
- Note: For folks who want this config to run with CSSU thumb.
- In "How" section, when producing clean/fresh images in Step 1, wipe your N900 clean - flash with stock PR1.3 root & optfs images.
- I'd advise to install latest kernel power (at time of writing, kernel power 52) to N900.
- Install CSSU thumb as per its instructions.
- Install Backupmenu.
- Backup & produce image for Step 1 in "How" section above.
- At Step 1, ensure you're running kernel power of the same version; install as necessary.
- Then, follow Step 1 to Step 15 in "How" section normally.

Considerations - More space in optfs:
- Note: Since apps will be installed to optfs/eMMC, you may want even more space in optfs. Optional but highly recommended. Here's how:
- Once you're done with Step 12 in "How" section, copy out produced Backupmenu images, flash your N900 using images produced from instructions in here: Refer to 5.5 "Solution #5: Edit eMMC image (works on PR1.2, by globalbus)" in http://wiki.maemo.org/Repartitioning_the_flash
- Ensure you're using the same kernel as the one in images created in Step 12.
- Copy in previously produced Backupmenu images, follow thru from Step 13 to Step 15 in "How" section normally.

Considerations - Suggestion for fastest way to build this to your current/latest image:
- Note: For folks who want to build this to their latest/current image in fastest manner. Here's a suggestion (that I've not tried before).
- This relies first on having FAM (Faster Application Manager) & complete current/latest backup images of your N900, including MyDocs. Ensure these are done/available & are kept outside of your N900 (in a separate computer).
- FAM can export list of apps you have currently installed, and can import this list to reinstall said apps. Produce this list and keep it outside of your N900 (in a separate computer).
- Produce image required as in Step 1 in "How" section; foundation of that image should be similar to your latest/current backup image. ie: If your latest N900 image has CSSU Testing, the clean/fresh image should not have CSSU Stable.
- Then, follow Step 1 to Step 15 in "How" section normally.
- After Step 16, ensure you have FAM installed, and use FAM's import feature to reinstall all apps that are in your latest backup image.
- Replace contents of /home/user & /home/user/MyDocs with those from latest backup image (you'll have to figure how to do this).

Compatibility:
- I would consider this "a Beta sort of software" and a Major hack (can be considered Minor too, depending on how you see it), and there is no guarantee of compatibility with future versions of CSSU or any OS updates especially. It is only assumed that this will be compatible with most apps based on its nature and workings.
- Tested with several possible combinations of stock kernel, kernel power, CSSU stable, CSSU thumb; all okay.
- Won't play well with things that specifically need /home/opt.
- Note on files modified:
-- N900bkmnutareditoptfsmountreorg:
--- /usr/lib/genfstab.awk - package: system-services*.deb
--- /etc/event.d/rcS-late - package: system-services*.deb
-- N900bkmnutareditrootoneMMCallenable:
--- /sbin/preinit - package: getbootstate.deb
-- N900bkmnutareditrootoneMMCfullcreate:
--- /etc/event.d/hildon-startup-progress - package: hildon-startup-progress*.deb
--- /etc/dbus-1/system.d/mce.conf - package: mce*.deb
--- /usr/sbin/maemo-optify-lib.sh - package: maemo-optify-runonce*.deb
--- /usr/lib/genfstab.awk - package: system-services*.deb
--- /etc/event.d/rcS-late - package: system-services*.deb
-- N900bkmnutareditrootoneMMChalfdo:
--- /etc/event.d/rcS-late - package: system-services*.deb
- Updates to packages having modified files may break this hack. Re-apply modifications from scripts as necessary manually to changed files before a reboot.
- 2013 Jun 16 update: Approximately near CSSU Testing 21.2011.38-1Tmaemo8 (07.06.2013), system-services_0.3.8-68+0cssu1_armel.deb is updated to system-services_0.3.8-68+0cssu6_armel.deb, changing rcS-late, how it uses fstab and not uses genfstab.awk. Short workaround instructions: As root, before CSSU install/update, run N900rootoneMMCprtlsyssvcwrkarndprep; run N900rootoneMMCprtlsyssvcwrkarnddo after CSSU install/update but before rebooting. Workaround details: As root, backup /usr/lib-nand/genfstab.awk, /usr/lib/genfstab.awk, /etc/default/mount-opts, /etc/event.d/rcS-late; after CSSU install/update, restore those files. Using the old files won't have any bad impact actually. Alternatively, use rcS-late and mount-opts from the new package unchanged, but create /etc/default/mount-opts-overwrite with correct values (you'd have to think this on your own for now).

Uninstalling: Not possible. Restore from previous Backupmenu archive or reflash to start afresh.

Credits:
- Various useful posts/articles in TMO: root on eMMC, freeing up space on rootfs, etc etc.

Note - My current set up:
- Kernel power 52.
- CSSU Thumb 21.2011.38-1Tmaemo7.2+thumb1.
- Bigger optfs, smaller MyDocs.
- MyDocs repartitioned to ext3fs.
- Lotsa other black magic.
- Included screenshot shows how mount points look like in my N900 & their used & available storage.

Disclaimer:
- Use at your own risk. I won't be liable for anything.

kh
Attached Images
  
Attached Files
File Type: tar n900scripts-rootemmcpartial.tar (11.0 KB, 82 views)

Last edited by bozoid; 2014-02-28 at 14:38.
 

The Following 5 Users Say Thank You to bozoid For This Useful Post:
Posts: 95 | Thanked: 66 times | Joined on Mar 2012
#2
Did a quick update to the main post for instructions dealing with CSSU updates to system-services*.deb that conflict with this hack.

kh
 

The Following 2 Users Say Thank You to bozoid For This Useful Post:
Reply


 
Forum Jump


All times are GMT. The time now is 04:16.