<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>grack.com comments on The lowdown on DBCache and ROM size</title>
    <link>http://www.grack.com/blog/</link>
    <language>en-us</language>
    <ttl>40</ttl>
    <description>grack.com comments</description>
    <item>
      <title>"The lowdown on DBCache and ROM size": comment by joad</title>
      <description>&lt;p&gt;Great article, thanks for the excellent explanation of this intensively troubling issue and how to possibly minimize the problems of filling up dbcache.&lt;/p&gt;</description>
      <pubDate>Fri, 10 Feb 2006 03:41:07 EST</pubDate>
      <guid>http://www.grack.com/blog/articles/2006/02/07/the-lowdown-on-dbcache-and-rom-size#comment-27</guid>
      <link>http://www.grack.com/blog/articles/2006/02/07/the-lowdown-on-dbcache-and-rom-size#comment-27</link>
    </item>
    <item>
      <title>"The lowdown on DBCache and ROM size": comment by Calash</title>
      <description>&lt;p&gt;It continues to amaze me how people can, by what can be called trial and error, discover so much about complex devices like this.  I follow several forums of various devices that I own and in each one there is a group of what would be called &amp;#8220;Hardcore&amp;#8221; owners who tear apart the devices and learn the secrets.&lt;/p&gt;

&lt;p&gt;My thanks to people like you, who not only take the time to learn this but also share it with the rest of us&lt;/p&gt;</description>
      <pubDate>Thu,  9 Feb 2006 16:37:09 EST</pubDate>
      <guid>http://www.grack.com/blog/articles/2006/02/07/the-lowdown-on-dbcache-and-rom-size#comment-26</guid>
      <link>http://www.grack.com/blog/articles/2006/02/07/the-lowdown-on-dbcache-and-rom-size#comment-26</link>
    </item>
    <item>
      <title>"The lowdown on DBCache and ROM size" by matt</title>
      <description>&lt;p&gt;There&amp;#8217;s been a lot of speculation on how &lt;span class="caps"&gt;ROM&lt;/span&gt; sizes affect free space and available DB cache since &lt;a href="http://shadowmite.com"&gt;Shadowmite&lt;/a&gt; opened up the world of &lt;span class="caps"&gt;ROM&lt;/span&gt; hacking.  Many theories have been proposed, but I&amp;#8217;d like to set the record straight by listing what we&amp;#8217;ve learned via disassembly, trial-and-error and various tests.&lt;/p&gt;


	&lt;p&gt;The key questions are how the size of &lt;span class="caps"&gt;ROM&lt;/span&gt; affects:&lt;/p&gt;


	&lt;ul&gt;
	&lt;li&gt;the available amount of DBCache&lt;/li&gt;
		&lt;li&gt;the &amp;#8220;free space&amp;#8221; measure&lt;/li&gt;
		&lt;li&gt;the amount of &amp;#8220;dynamic memory&amp;#8221;&lt;/li&gt;
	&lt;/ul&gt;


	&lt;p&gt;To properly answer these questions, it&amp;#8217;s best to give a quick overview of what happens when a Treo boots after a reset.&lt;/p&gt;


	&lt;h3&gt;The boot process&lt;/h3&gt;


	&lt;p&gt;One of the key points to know is that the only persistent storage available on the Treo 650 is the internal &lt;span class="caps"&gt;DOC &lt;/span&gt;(disk-on-chip).  This is a 32MB flash memory that uses a special library from MSystems to make it look like regular random-access storage.&lt;/p&gt;


	&lt;p&gt;The first thing that the &lt;span class="caps"&gt;CPU&lt;/span&gt; does is load the initial program loader or &lt;span class="caps"&gt;IPL&lt;/span&gt; from a special location on the &lt;span class="caps"&gt;DOC&lt;/span&gt;.  The sole job of the &lt;span class="caps"&gt;IPL&lt;/span&gt; is to load the secondary program loader, or the &lt;span class="caps"&gt;SPL&lt;/span&gt; into memory at a given address.&lt;/p&gt;


	&lt;p&gt;The &lt;span class="caps"&gt;SPL&lt;/span&gt; has a number of responsibilities itself, but the one we&amp;#8217;re most concerned about is the job of loading the tertiary program loader, or &lt;span class="caps"&gt;TPL&lt;/span&gt;.&lt;/p&gt;


	&lt;p&gt;The &lt;span class="caps"&gt;TPL&lt;/span&gt; is a very simple program that takes the compressed &lt;span class="caps"&gt;ROM&lt;/span&gt; stored on the &lt;span class="caps"&gt;DOC&lt;/span&gt;, uncompresses it to &lt;span class="caps"&gt;RAM&lt;/span&gt; and boots the specified image of PalmOS.&lt;/p&gt;


	&lt;p&gt;The &lt;span class="caps"&gt;ROM&lt;/span&gt; files that the &lt;span class="caps"&gt;TPL&lt;/span&gt; decompresses are placed directly into an area of memory that is reserved for the decompressed &lt;span class="caps"&gt;ROM&lt;/span&gt; files.&lt;/p&gt;


	&lt;h3&gt; The &lt;span class="caps"&gt;DOC&lt;/span&gt; partition layout&lt;/h3&gt;


	&lt;p&gt;The Treo&amp;#8217;s internal storage is partitioned internally into two separate areas: the &lt;span class="caps"&gt;ROM&lt;/span&gt;/boot partition and the &lt;span class="caps"&gt;NVFS&lt;/span&gt; partition.  These two partitions are essentially treated as two separate storage devices.&lt;/p&gt;


	&lt;p&gt;The only time that the partition layout changes is during a &lt;span class="caps"&gt;ROM&lt;/span&gt; update.  The size of the &lt;span class="caps"&gt;ROM&lt;/span&gt; partition is actually hardcoded in the program that updates the &lt;span class="caps"&gt;ROM&lt;/span&gt; files.  The size of the &lt;span class="caps"&gt;NVFS&lt;/span&gt; partition is calculated as being the remaining space available on the &lt;span class="caps"&gt;DOC&lt;/span&gt; itself.  For example, if the rom updater was hard-coded to an 8MB &lt;span class="caps"&gt;ROM&lt;/span&gt; partition, the &lt;span class="caps"&gt;NVFS&lt;/span&gt; size would be approximately 24MB.&lt;/p&gt;


	&lt;h3&gt; The &lt;span class="caps"&gt;ROM&lt;/span&gt;/boot partition&lt;/h3&gt;


	&lt;p&gt;As previously mentioned, the &lt;span class="caps"&gt;ROM&lt;/span&gt;/boot partition contains the &lt;span class="caps"&gt;TPL&lt;/span&gt; that boots the ultimate PalmOS image.  It also contains the program that is often referred to as the &amp;#8220;HTC bootloader&amp;#8221;, which is a separate program used for diagnostics (and &lt;span class="caps"&gt;ROM&lt;/span&gt; recovery with our tool).&lt;/p&gt;


	&lt;p&gt;The &lt;span class="caps"&gt;ROM&lt;/span&gt;/boot partition is not a standard  partition format of any kind.  It contains three zip files laid out at three specific locations, with the majority of the remainder of the partition containing zeros.  
The three zip files contained in this partition are:&lt;/p&gt;


	&lt;ol&gt;
	&lt;li&gt;The &lt;span class="caps"&gt;HTC&lt;/span&gt; bootloader&lt;/li&gt;
		&lt;li&gt;The PalmOS &lt;span class="caps"&gt;TPL&lt;/span&gt;&lt;/li&gt;
		&lt;li&gt;The &lt;span class="caps"&gt;ROM&lt;/span&gt;&lt;/li&gt;
	&lt;/ol&gt;


	&lt;p&gt;The &lt;span class="caps"&gt;ROM&lt;/span&gt; zip file is an exact copy of the &lt;span class="caps"&gt;ROM&lt;/span&gt; that was uploaded during the &lt;span class="caps"&gt;ROM&lt;/span&gt; update process.  There is no further compression done on this file by the &lt;span class="caps"&gt;ROM&lt;/span&gt; update process.&lt;/p&gt;


	&lt;p&gt;If the total length of the &lt;span class="caps"&gt;ROM&lt;/span&gt;/boot partition is 9MB and the files within only total 7MB, 2MB of the partition contains zero bytes and is effectively wasted.&lt;/p&gt;


	&lt;h3&gt; Division of &lt;span class="caps"&gt;RAM&lt;/span&gt;&lt;/h3&gt;


	&lt;p&gt;The three things that PalmOS uses the main memory for are uncompressed &lt;span class="caps"&gt;ROM&lt;/span&gt; files, DBCache and dynamic &lt;span class="caps"&gt;RAM&lt;/span&gt;.&lt;/p&gt;


	&lt;p&gt;The size of the uncompressed &lt;span class="caps"&gt;ROM&lt;/span&gt; files is a fixed number that varies only by &lt;span class="caps"&gt;ROM&lt;/span&gt; contents.  The size of dynamic &lt;span class="caps"&gt;RAM&lt;/span&gt; is fixed, but varies slightly according to the version of PalmOS that is loaded.  The end result of this is that DBCache is calculated as the remaining memory once the &lt;span class="caps"&gt;ROM&lt;/span&gt; is uncompress and dynamic &lt;span class="caps"&gt;RAM&lt;/span&gt; is allocated.&lt;/p&gt;


	&lt;h3&gt; The conclusions&lt;/h3&gt;


	&lt;p&gt;So, let&amp;#8217;s revisit our original question:&lt;/p&gt;


	&lt;p&gt;How does the size of the &lt;span class="caps"&gt;ROM&lt;/span&gt; affect the available amount of DBCache, the &amp;#8220;free space&amp;#8221; measure and the amount of &amp;#8220;dynamic memory&amp;#8221;.&lt;/p&gt;


	&lt;p&gt;First of all, let&amp;#8217;s look at DBCache.  It was mentioned above that DBCache is calculated by taking the remaining memory once the uncompressed &lt;span class="caps"&gt;ROM&lt;/span&gt; and dynamic &lt;span class="caps"&gt;RAM&lt;/span&gt; have been allocated.  The conclusion we can draw from this is that &lt;strong&gt;when you reduce the size of your &lt;span class="caps"&gt;ROM&lt;/span&gt;, total DBCache increases by the size of the files you remove&lt;/strong&gt;.  The same is true in reverse &amp;#8211; adding files reduces your DBCache in the same way.&lt;/p&gt;


	&lt;p&gt;The &amp;#8220;free space&amp;#8221; measure is calculated by taking the size of the &lt;span class="caps"&gt;NVFS&lt;/span&gt; partition and subtracting the stored &lt;span class="caps"&gt;NVFS&lt;/span&gt; data.  As mentioned above, the &lt;span class="caps"&gt;NVFS&lt;/span&gt; partition is of a fixed size given a version of the &lt;span class="caps"&gt;ROM&lt;/span&gt; update application, so &lt;strong&gt;adding or removing files from your &lt;span class="caps"&gt;ROM&lt;/span&gt; will not affect the total amount of free space&lt;/strong&gt;.&lt;/p&gt;


	&lt;p&gt;Note that you can, however, use a different &lt;span class="caps"&gt;ROM&lt;/span&gt; updater application to provide a smaller &lt;span class="caps"&gt;ROM&lt;/span&gt; partition size and, therefore, a larger &lt;span class="caps"&gt;NVFS&lt;/span&gt; and &amp;#8220;free space&amp;#8221; amount.&lt;/p&gt;


	&lt;p&gt;Finally, we mentioned above that the amount of dynamic &lt;span class="caps"&gt;RAM&lt;/span&gt; is effectively fixed, given a certain version of firmware.  This means that &lt;strong&gt;reducing or increasing the size of your &lt;span class="caps"&gt;ROM&lt;/span&gt; has no effect whatsoever on the remaining dynamic &lt;span class="caps"&gt;RAM&lt;/span&gt; size&lt;/strong&gt;.&lt;/p&gt;


	&lt;h3&gt; Recommendations&lt;/h3&gt;


	&lt;p&gt;Based on the given data, it is recommended to make your &lt;span class="caps"&gt;ROM&lt;/span&gt; as small as possible to increase your DBCache as much as possible.&lt;/p&gt;


	&lt;p&gt;Adding files to the &lt;span class="caps"&gt;ROM&lt;/span&gt; is effectively akin to locking them into DBCache using a program such as Resco Locker.&lt;/p&gt;


	&lt;p&gt;If you can, strip out any non-essential Palm applications from your &lt;span class="caps"&gt;ROM&lt;/span&gt; and run them from &lt;span class="caps"&gt;RAM&lt;/span&gt;, if possible.&lt;/p&gt;


	&lt;p&gt;Once you have stripped your &lt;span class="caps"&gt;ROM&lt;/span&gt;, ensure that you are using a &lt;span class="caps"&gt;ROM&lt;/span&gt; updater that gives you the smallest possible &lt;span class="caps"&gt;ROM&lt;/span&gt; partition that still fits the size of your &lt;span class="caps"&gt;ROM&lt;/span&gt;.&lt;/p&gt;

</description>
      <pubDate>Tue,  7 Feb 2006 16:02:00 EST</pubDate>
      <guid>&lt;a href="/blog/articles/2006/02/07/the-lowdown-on-dbcache-and-rom-size"&gt;The lowdown on DBCache and ROM size&lt;/a&gt;</guid>
      <link>&lt;a href="/blog/articles/2006/02/07/the-lowdown-on-dbcache-and-rom-size"&gt;The lowdown on DBCache and ROM size&lt;/a&gt;</link>
    </item>
  </channel>
</rss>
