In the previous section, we went through the SYS folder in detail. Now, its time to dab a little into how you can remove packages from your ROM to clean up unwanted stuff!
Removing Packages
To remove a package, simply delete the directory with the app! Now, the caveats -
1. If this package is cross referenced by some other application/module, that'll have issues
2. Its a bad idea to remove certain core applications (For example, removing the phone application is just a crazy idea ;))
3. Lets run through an example here. We could remove "WindowsLive" application/package by just deleting the following folders from your SYS folder - "WindowsLive", "WindowsLive_DPI_96", "WindowsLive_Lang_0409", "WindowsLiveIM". Doing this is safe, and does not affect any other application - so you could go ahead and get rid of this altogether without compromising runtime integrity.
Why remove packages?
Its a good idea to keep the device clean and weed out all the rubbish! The idea is to free up space for some other custom application we can put into it instead which is of more value!
What does a package folder contain?
A package normally contains the following contents -
1. A .dsm file -
This file defines "what is present in that folder". You can build a .dsm file using the tool "buildDSM". Not populating DSM files just make it harder to extract the rom correctly and hence is a good practice to generate these files. When you dump a ROM, you will find .dsm files with each package. Its only when you create your own custom package to insert into a ROM, its a good idea to generate .dsm files. This is however made easy using Ervius' package creator tool. I shall cover creating and adding packages in the next post in detail!
2. A .rgu file -
A .rgu file contains the registry information that needs to be added for this package. This is a standard registry settings file. One could use this to add custom registry entries to tweak the OS and deploy it in this manner! So, a package can sometimes contain just a .rgu file with some registry keys/info to apply onto the device!
3. Files/folders
Now, this calls for talking a little about "Modules" and "Files"!
Some of the files (.exe, .dll, .mui, .cpl files) can exist either as a "Module" or as a "File". You can identify a "Module" when you see a directory which has the name of a file! For example, look inside the "Phone" package - you see a bunch of directories which are actually names of files! An executable/dll/mui/cpl file can be converted into a "Module" and this makes it much quicker to execute at runtime. Thats an advantage right, so we can have all of them saved up as modules right? Whats the catch?
Modules - the catch!
The number of modules we can have should not exceed 32Megs in total on a WM6.1 kernel! So, the total number of modules you have in your rom should never go beyond this limit! For our Samsung i780 devices, we still have a WM6.1 kernel and we have to thereby live with this memory limitation. There is a tool called Recmod.exe which helps you convert a "Module" to a file. So, a ROM chef needs to convert some modules to files to make sure that you don't go over the limit. An easy way of finding if you're in the safe zone is by just checking folder properties of the SYS folder and ensuring the total number of directories are under 510.
IMPORTANT: Some "Modules" don't like being converted to files! They don't convert properly OR have problems at runtime! So, its best practice to leave all the core operating system components as modules and not convert them to files. Examples -
1. BASE_DPI_96 folder
DO NOT convert the modules in this folder to files - you would like to leave core OS components as modules to get better performance, and also not risk the probability of run time failures/issues
2. AdobeFlash folder
Feel free to convert whatever modules you have into files! You really don't need run time performance for this!
3. WindowsLive and all its collateral crap!
All these are non-critical apps, convert all the modules you can find into files to save on memory available!
What I basically do is, I leave BASE_DPI, BASE_LANG, OS, MediaOS, CHome, Redist, BaseApps, Enterprise, NetCF, Riched, Phone folders as modules - DO NOT convert them to files as they're bound to throw some errors at runtime! What you should do is clean up the other application packages to bring your rom to have the number of modules under the limit that we have!
More on this later, in another post! I shall explain how to convert files/modules back and forth, best practices, tools you need etc.!
A quick recap on removing packages - Just delete the folder! Simple :) You need to be sure that they are not cross referenced, or we might have issues at runtime/bootup etc. Another example I can think of is a package called "SQM". This stands for System Quality Metrics (Customer feedback as we all know it ;)). You might think you could just delete this and get rid of customer feedback within the OS....but it turns out that the DLL files are cross referenced and used by many other apps! So, getting rid of it is not as straight forward ;)
Thats it for now guys! cheers :)