[Nook Touch Android Development] nmyshkin:
First, the tease.

Note: This video was prepared before I thought about/tested Aldiko Classic as a replacement (and improvement) for Overdrive. See post #2 for more information.

Disclaimer: I am not responsible for any damage that might result to your device by improperly using the files I have provided. Do not charge your device while reading in the bathtub. Do not use your device as a projectile. Read safely.

I've been working with the abandoned sdcard-based CM 11 ROM for a couple of months now, trying to see if anything could be done with it. Having never tried it back in 2015 when @kfazz was actively working on it, I wasn't sure what to expect, but having worked with an 8 gb Nook Tablet ("only" 512 mb RAM) for a long time and with various resource-hungry ROMs, I wasn't expecting much.

First, two myths to dispel:

1. It will NOT "burn" spots in your display. Trust me, if it hasn't done anything to mine in the endless hours I've spent swearing at it, it won't hurt yours.

2. It does NOT leave your stock internal storage entirely alone, but the change is minimal. An "Android" folder is placed in /media and a few apps may store a little data there.

Here's a short list of issues I found, in no particular order. Some are just annoying and can be addressed peripherally. Others are more granular in nature and are beyond anything I could fix. It may now be impossible to address the issues directly if this post is any indication. Of course, the Cyanogenmod folks have moved on to Lineage so the build components may not be accessible any longer.

1. it is sloooooow

2. it is not nice to look at (all Themes I tried destabilized the ROM--so live with it)

3. it does not understand the whole screen off/sleep/wake routine

4. it doesn't really seem to understand the whole e-ink thing

5. it drains battery power like a Black Hole app has been installed

6. it is a nuisance to swap out the sdcard to boot this ROM

7. it is a little unstable....

8. booting into TWRP can be very frustrating

9. the shutdown screen is a crapshoot (all white, the current display, a garbled mess, etc.)

I could go on, but as I worked with the ROM my perspective changed repeatedly until I finally realized that rather than complaining about what it could not or would not do, it would be more helpful to see if it could be used to do something that the stock NST no longer could. For example, NoRefresh doesn't work on the CM 11 ROM but it works wonderfully on the stock NST. There is some issue with screen overlays in KitKat and they are used in the NoRefresh app. Also, there is no USB Host in the CM 11 ROM, although this was mentioned early in the original postings. But USB Host (and Audio) works famously on the NST. Etc. So perhaps the real issues should be:

1. Is there any reason to run the CM 11 ROM?

2. If CM 11 is not fit to be a daily driver, could it be possible to go back and forth between stock and CM 11 easily?

Also, the two ROMs share a common partition: /media (called sdcard1 on the CM 11 ROM). This means files can be shared between them. So I can use a more modern browser (but not very modern....) on the CM 11 ROM to download a PDF of the newspaper (something Opera Mobile cannot negotiate on the stock ROM), move the file to the shared partition, then reboot into the stock ROM and read the file using EBookDroid with NoRefresh :) Or, I can download an app using the Yalp Store (which should run on the NST but does not), move the file to the shared partition, reboot and install the app on the stock ROM (if it runs on Android 2.1).

What I've done

I have worked mainly with build 2 of the CM 11 ROM. Initially I found build 3 to be markedly less stable, but it may be worth it to revisit my work at some point now that I'm not going to be trying truly crazy stuff. These are the changes I have made:

1. Removed Calendar and Calendar Storage. If you want a local calendar, you can extract the apps from the original build 2 ROM zip or any other CM 11 ROM.

2. Removed Sound Recorder (duh)

3. Removed Trebuchet launcher. It's just hopeless for the NST display.

4. Removed a bunch of Wallpaper and Theme stuff. Face it, plain white (included) is best for the wallpaper.

5. Removed Bluetooth app (duh)

6. Replaced the broken Gallery

7. Restored People (contacts) for local use (load in a .vcf file)

8. Restored the stock AOSP Email app

9. Added a custom boot splash screen (whoopee!)

10. Added ADW Launcher to replace Trebuchet

11. Added AdAway

12. Added the Yalp Store (fork)

13. Added a re-themed RotationLocker (you can actually read the options!!!)

14. Added the updated kernal files and recovery files suggested in the original thread

15. Added the Boot Nook OS app (this, with a companion app for the stock NST allows a form of "dual boot")

16. Added the Screensaver app (this works--mostly--like on the stock NST)

17. Added an NLP app for Location, if turned on

18. Enlarged the /userdata partition to 1 gb

19. Slightly edited build.prop so apps that try to ID the NST can succeed

And, of course, I've combed through the settings for both the ROM and launcher, trying to minimize animations, kill background processes, etc. Anything to calm the OS down.

I have prepared two sdcard image files (see downloads section below). Unlike the images in the original post, these are installed and pre-configured so they are ready to try as soon as you write them. Of course you may not agree with all my settings/tweaks, and are free to take my work as a starting point. I'm hoping that this post may revive some interest in this ROM and people with more knowledge than I will run with it, or at least offer a few more tips and tweaks.

"Dual Boot"

I looked at this issue for a long time. In the development work on the Nook Color someone eventually produced a mod to enable booting to either internal or sdcard ROMs by holding down the "n" button during boot for one of the options. Eventually someone else came up with a boot menu. These innovations involved u-boot and kernals. This is arcana to me, way beyond my pay grade. I did make a desultory binary comparison of some files and eventually gave up. Then one day an outside-the-box idea came to me. What would happen if the device could not boot from the sdcard for some reason? The answer is: it would boot from the internal stuff. A quick renaming of u-boot.bin on the sdcard confirmed this. So, how to rename this file going from either ROM? Coming from the stock ROM it's easy because the "boot" partition of the sdcard is a FAT32 partition and the only part of the card the stock ROM can see. Then just add a reboot command. Done.

Coming from the CM 11 ROM it is more complicated because the "boot" partition is invisible. With the help of @Renate NST I was able to sort out a series of shell commands which mount the "boot" partition, rename the file (I finally settled on renaming MLO rather than u-boot.bin), and execute a reboot. So a different but simple app for each ROM and you can go back and forth without shutting down and swapping cards. The added advantage is that you can put the NST to bed on the stock ROM where it will not use so much power, rather than shutting it down entirely.

Setting up "dual boot" requires a little work if you want to maintain your existing stock files on the sdcard. Here are the steps:

1. Copy the contents of the regular sdcard you use in your NST to a PC.

2. Insert the CM 11 sdcard you have prepared by burning one of the two images I supplied into the card reader of your PC.

3. Start MiniTool Partition Wizard.

4. Identify the sdcard in MiniTool Partition Wizard. You will see that there are four partitions. The "boot" partition is the first and active one. Right-click on this partition and select "Extend". When the dialog appears, drag the sizing indicator all the way to the right (i.e., use up all the unallocated space).

5. When you've got all the changes set up, be sure to hit "apply" so that it all really happens.

6. Close MiniTool Partition Wizard.

The card is now fully accessible to the stock ROM except for the three hidden CM 11 ROM partitions, /system, /cache, and /userdata. Copy the contents of your regular sdcard that you previously saved on your PC onto the newly adjusted CM 11 card. Voila!

The only drawback (besides the loss of about 2 gb of space) is that the files in the "boot" partition will be visible when you use a file manager from the stock ROM. I use ES File Explorer on my stock NST and it allows me to hide files and folders I don't need to access and don't want to look at. Otherwise, you just need to ignore them (and certainly don't delete them!).

Oh, and you need to install the "Boot CM 11" app on your stock NST (download section below). This is a Tasker-generated app. If you already have one of my other Tasker-generated apps or have previously installed GApps, you don't need the two Google maps library files included in the zip and can delete them. If you do need them, copy the two files into the locations shown below (remember, these are for the stock NST--the CM 11 ROM already has these files):

/system/etc/permissions/com.google.android.maps.xml

/system/framework/com.google.android.maps.jar

Set permissions for both files to rw-r--r-- and reboot. Without these files resident, the app will not install.

Apps

I went pretty much nuts at the beginning of my work, installing all kinds of stuff. A lot didn't work. This ROM is not a panacea for all the issues surrounding the aging (but beloved) NST and certainly not the place for fancy screen tricks and cute widgets. There just isn't enough RAM. There are other issues, but that is the big one. I recognize all the signs from my work with the RAM-poor 8 gb Nook Tablet. Of course, the processor is also slow. And there are display issues with the e-ink that some apps just can't get past, not to mention a rather odd screen size and aspect ratio. Here's what I learned:

Stock apps

The stock apps I left on the ROM all work "OK". I don't much care for the File Manager because there is no simple way to get out of it and contrast seems unneccessarily poor, but ES File Explorer (the 3.x series) runs more slowly and gets confused about the emulated and internal storage. It also interacts poorly with the package installer, taking a very long time to install apps. Email works fine and easily adds Gmail accounts. Others might require a little more work. Of all the system apps, the Browser is the most impacted in performance by the device and ROM limitations. I have found this to be true with all the ROMs I have worked with on the Nook Tablet. For KitKat the problems are exacerbated by the outdated Webview. Some sites (like XDA!) cannot display properly. Form input and even response to touching "buttons" is just really awful. If you are patient and don't madly tap over and over to get the attention of the device, you can use the stock Browser, but it is prone to freezing and crashing. That said, it can do some surprising things. For example if you are signed in to Google (painful in itself), it is able to display your full calendar (the only way to see it on the non-microG version), but it takes a long time. I left the app on the ROM, but you could remove it. I use it to access the newspaper, but only to get to the point where I can download a PDF, not to actually try and read it in the Browser. If the stock Browser has any other saving grace it is that the page-up and page-down commands (lower two hardware buttons) move the display. This compensates somewhat for the lack of NoRefresh and the rather overenthusiastic swipe-scroll response of the ROM.

I tried oh-so-many other browsers. I can't begin to count. The performance of most all was dismal. In the end, I settled on Opera Mini (but not the version that runs on the stock NST). I'm not a big fan of Opera Mini. There are many sites it can't display, but this version, which includes an ad-blocker, works really well with library OverDrive sites (yes, you read that correctly!) and generally sails through forms and interactive screens. Unfortunately it does not respond to the page-up/down commands.

Other user apps

I tried all the typical readers before I realized that was just stupid. Most work very well, although you need to up the version on a few to achieve full-screen reading, and the readers with bookcover screensaver actions need modifying to find the correct folder. I did this successfully with the current PlayStore version of AlReader but had less success with CoolReader. The FBReader version for the NST cannot display full screen, but the ICS version (available from the FBReader website) works well and can run the PDF plugin (presumably the DJVU as well). No version of Kindle runs well--if at all. The closest thing is Kindle Lite 1.9, but it is quite slow and cannot read local .mobi files. The right version of OverDrive runs reasonably well once the book is loaded. If you want to run OverDrive, be sure to look at the second post in this thread. News apps were possible but just really, really slow. Any app that needs to assemble a complicated Webview is a problem--this includes the in-app library browser of OverDrive. And then there is the issue with GSF (Google Services Framework). We don't really run into this with the stock ROM because all of our apps are so old. But with KitKat you begin to get apps that refuse to run or run poorly because you don't have GApps installed. Even the NPR News app....

So let's talk Google. First, NO GApps. Never. No. Just no. The ROM, as configured, runs with about 60-90 mb of free RAM (at least according to the information shown in Settings), a little more if you forego Email. In an extended moment of folly, just to see, I did struggle with GApps, after enlarging the /system partition on the card. It took two days, much searching on-line, and many words that do not come from children's books, but I did get a pico GApps package installed. That left about 30 mb of free RAM and absolutely nothing would work. I knew that would be the result from my work with the 8 gb Nook Tablet, but I just wanted to say, authoritatively, NO.

However...my work with the Nook Tablet also eventually led me to microG. Could that even work on this ROM? The short answer is yes. I have successfully enabled signature spoofing (but only for microG) and installed and configured microG.

microG, at its most basic level, spoofs the signature of GSF that many apps look for. At that level of service it adds very little overhead to the system. The next step up is adding an actual Google account. This does increase system activity but only a little if you don't go crazy with things. With an account you can run some Google apps like Books and Drive, assuming you can find versions that will work.

I've identified working versions of Google Play Books and Google Drive (included in the apps download below), but I don't guarantee they will work forever. Even after I thought I had found a good version of Google Play Books I got an email from Google saying they were going to stop supporting that version "soon". So I tried a few more recent versions and found another. No emails so far...

You could theoretically run the PlayStore at this level of microG, but it just won't work on this device. Google insists on updating it and while a Jellybean version might run quite well, it won't be around long and then after the automatic update it will be a useless burden on the system. Fortunately, the fork of the Yalp Store (which should run on the NST but does not) works well on the CM 11 ROM, although not with a generic Yalp Store account. I opened a Google account just for this purpose when I started working with the 8 gb Nook Tablet and this is the only thing I use the account for. I suggest you do something similar, just in case. This will give you PlayStore access, although you will not be able to purchase apps. If you select the microG version be sure to take a look at post #3 below.

That's about it. I tried a Crossword app, and a few other oddities, but in the end I still feel that running things on this ROM that function perfectly well (or better) on the stock ROM does not make a lot of sense. It should be all about the stuff you otherwise could not do--within reason :)

Lastly, a word about my Screensaver app. I've attempted to "solve" or work around a number of issues using this app. The screen off/sleep/unlock cycle only works "correctly" when the device is plugged in (AC or USB). Otherwise, waking the device requires a tap on the power button followed by a press of the "n" button. Perhaps that's a "feature". When I finally understood the situation I tried to figure out how to work around it. Eventually I hit on the idea of spoofing the battery state at "screen off" if the device is not charging. So the app monitors the screen and when it detects the screen-off state it tells the system that wireless charging has begun (if there is not already charging happening). Then the app pushes an image to the screen (which would otherwise be either black or the last current display--at random). Tasker (which I used to create the app) cannot overlay the nav bar so you will still see that. That means screensaver images are about 600x752 rather than 600x800. This generally works quite well, but there are two issues I have not been able to solve. Sometimes the first screen off goes to black. After that it all works fine. Also, pushing the image to the screen seems to reset the lock timer. So if your timeout is set to 5 minutes, the screen remains unlocked for roughly another 5 minutes after the image is displayed. During this time a simple swipe across the image in any direction will clear the screensaver (and reset the battery state). Otherwise, after lock, a press of the "n" button, followed by a swipe over the image will both unlock and clear the image (and reset the battery state). I tried sending a lock code myself after the image was displayed but that always resulted in a black screen. You can change the screensaver folder as long as you place your images in a folder inside /storage/emulated/0/Screensavers. If there is more than one image in the folder you select, the app will cycle through them, just like on the stock NST.

As a hopeful afterthought I also tried to address the random shutdown image. A careful reading of the original thread indicates this is supposed to be a white screen. The developer admitted this was subject to perfect timing, racing against the clock before parts of the system shut down. I attempted to force a blocking overlay onto the screen when shutdown is detected. A blocking overlay cannot cover either the status bar or nav bar, but at least you could tell the device is off. When it worked. For the time being I have removed this feature because it's almost as random as the native ROM itself. I'll keep picking at it, but I'm out of ideas at the present.

Getting going

1. Download one of the two images below, choosing whether you want the simple version or the one with microG installed. Each image is just over 2 gb so you will need at least a 4 gb sdcard to burn, probably larger if you plan to run "dual boot". I generally use 16 gb cards with most of my devices (a few have 32 gb cards), but that's probably overkill for the NST.

2. Use Win32DiskImager or similar to burn the image you downloaded to the card.

3. If you intend to run "dual boot", follow the directions above to extend the "boot" partition over the unallocated section of the card and copy your existing stock ROM sdcard files to the card. You will also need to install the "Boot CM 11" app on your stock NST (the companion app is already on the CM 11 ROM).

4. Shut down your NST, insert the CM 11 card and power up. The device will boot into CM 11 in three "stages": a splash screen, a white screen, a black screen. A very few apps have been pre-installed and some general configuration has been done. The rest is up to you!

Note: you don't have to be concerned about the hardware information like serial number, MAC address, etc. When the CM 11 ROM boots it apparently reads these from the internal storage. I tried this by switching my working cards to another NST and found that the values were correct for the currently running device.

TWRP

Remember the disclaimer at the beginning? That bit about not using your device as a projectile? That is about TWRP. Works great if you can get to it. From power off, or on reboot, press and hold the two lower hardware buttons as soon as you see the splash screen. Count to ten (not too slow, not too fast....) and then release the buttons. If you are successful, the boot process will briefly pass into the white screen and then TWRP. If you have an NSTG, the light will come on at some point (but that may not mean ultimate success). I've looked at this quite a bit to see if there could be a way to construct a simple app to force a reboot into TWRP without the button business. Just before posting all this I took another look through the original thread and there was the answer staring me in the face. But it's not a good answer. I have put together a small app to "force" a reboot into TWRP. It does this by mounting "boot", renaming boot.scr to boot.scr.bak, making a copy of twrp.scr named "boot.scr" and rebooting. This has a better success rate than the traditional method (at least for me), but it does occasionally hang at the splash screen (which is what the button method does for me about 80% of the time). In the two installations I have tried it failed on the first try, perhaps because of the delay in obtaining SU permission. Then it was fine. More importantly, the device is going to keep booting into TWRP unless you undo what the app did before you leave TWRP. It's lame, I know. The directions are given in the dialog box called up by the app. I did not include this app with the images because it really is just barely a "fix". If you want to give it a try, you can get it from the downloads section below.

If you want to flash any zips place them in /media on the stock NST, then mount /media when you enter TWRP.

If you want to make a backup it's tricky. This version of TWRP is coded to see only "internal" storage. But that's not what you might think. It's the sdcard, but only part of it. Despite having loads of free space on my sdcard it keeps showing me "569 mb" or similar. That is obviously not enough space for a 2+ gb backup, although of course the actual file contents are less than that. I believe this space measurement is the free space in the /userdata partition since backups appear in /storage/emulated/0/TWRP/BACKUPS/<serial_number>. So one approach is to enlarge this partition enough to accommodate a full backup. But that makes an image painfully large to download. My idea so far has been to make one or two backups, depending on how much is in userdata. So maybe system+cache, and userdata. Or, if there is enough space, all three at once. After each, I reboot and copy off the file to my PC, then delete it on the device. I successfully did a two part backup and then restored it, system+cache first, then after a reboot, userdata. This worked. The "boot" partition is easy enough to backup manually because your PC can see all of it.

"This was all a waste of my time. How can I recover my sdcard?"

Insert the card into the card reader of your PC and copy off the files from the stock ROM to restore to a clean card. Start MiniTool Partition Wizard. Identify the sdcard and right click on the three partitions: /system, /cache, /userdata, and delete them. Apply. This leaves only the active "boot" partition and some "unallocated space". Right-click on this partition and Extend it over the freed up space. Apply. You should now have a single space equivalent to the size of the card in a single partition. At this point the card can be reformatted with Windows or something like SDFormatter.

Downloads

NST_CM11.img (2 gb)

NST_CM11_microG.img (2 gb)

Boot_CM11.zip (for the stock NST)

Boot_TWRP.apk

CM11_Apps.zip