Patch webOS Bypassing Activation

From WebOS Internals

Revision as of 21:19, 12 December 2010 by LuWangui (Talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search


Note that this page was written for webOS 1.0.3, and may not work for later versions (although the general principles will probably be the same).

If you're after a maintained tool to do this, look for the WebOS Internals Meta-Doctor.

If you are outside of Sprint's service area in the United States and would like to still be able to use your Pre, you are required to possess a Palm profile. The phone will not let you past the "create profile" screen because it cannot hit Palm's servers over the non-working EV-DO connection.

This modification will allow you to enable WiFi and use that to create your Palm Profile. The phone is otherwise unchanged and would still work if it was brought back into a Sprint service area.

NOTE: You may need to use a Mac or Linux machine to do the file editing, otherwise the /dev folder will be empty and YOUR PHONE WILL NOT BOOT.

Contents

Procedure with a good ESN phone

Verified Working Procedure:

Note: These instructions and patches were created for WebOSdoctor 1.0.2, so the locations of lines may be different on later versions.

1. Download the WebOS image.

2. Rename this file to .zip, and extract it.

3. Untar resources\webOS\nova-cust-image-castle.rootfs.tar.gz.

4. Check to see that /dev has files in it after untarring. If it does not, try untarring as root.

5. Open file /usr/palm/applications/com.palm.app.firstuse/app/controllers/app-assistant.js.

6. Change the setUpFirstUse() function.

function setUpFirstUse () {
setupSimulator (); 
isDevice = true; 
}

7. Apply the diff's to the following 2 files:

command:

patch foo.js < patch

files to patch:

/usr/palm/applications/com.palm.app.firstuse/app/controllers/firstuse-util.js
204a205
>                                       {label: $L('Enable WiFi'), command: 'peef-hack-mode'},
221a223,224
>               } else if (value == "peef-hack-mode") {
>                       AppAssistant.accountService.peefMode();
/usr/palm/applications/com.palm.app.firstuse/app/models/account-service.js
392a393,402
>
>         peefMode: function() {
>                return new Mojo.Service.Request("palm://com.palm.applicationManager/open", {
>                        parameters: {
>                               id: 'com.palm.app.wifi',
>                                params: {
>                                }
>                        }
>                });
>         },

8. Edit /usr/lib/ipkg/info/com.palm.app.firstuse.md5sums and add the correct md5 of app-assistant.js, account-service.js, and firstuse-util.js.

md5sum (file.js)

9. Edit /md5sums file and add the correct md5 of app-assistant.js, account-service.js, and firstuse-util.js, and /usr/lib/ipkg/info/com.palm.app.firstuse.md5sums. (These two steps are not necessary, but if you don't do them, the flashing will fail. The phone should still reboot and work as normally though.)

10. Pack the nova-cust-image-castle.rootfs folder into nova-cust-image-castle.rootfs.tar.gz (make sure that the tar's root contains the root file system, and not a folder containing the root file system).

tar cvpzf ../nova-cust-image-castle.rootfs.tar.gz ./

11. Pack the webOS folder into webOS.tar. Make sure that the root of the .tar contains the files in webOS and not a folder containing the files in webOS.

tar cvf ../webOS.tar ./

12. Remove JARKEY.RSA and JARKEY.SF from \META-INF.

13. Edit the MANIFEST.MF in \META-INF. Remove all of the SHA-1 hashes and leave just the following three lines at the top of the file.

Manifest-Version: 1.0
Created-By: 1.6.0_04 (Sun Microsystems Inc.)
Main-Class: com.palm.nova.installer.recoverytool.RecoveryTool

14. Pack the .jar back up. You can use zip to do this. NOTE: If zipping it is resulting in an unusable jar file, make sure you have the JDK installed and use:

jar cvMf flasher.jar * #if you are in the folder containing resources, META-INF and com folders

15. Hold the volume up button while plugging in USB cable.

16. Flash it by starting the flasher tool.

java -jar flasher.jar

17. Once you get to the "Create Palm Profile" screen, tap the little phone icon down in the lower right notification area.

18. Choose the "Enable WiFi" menu item.

19. When the WiFi control opens, enable WiFi and connect to your local WiFi network (must allow internet accesss).

20. Close the WiFi panel and then proceed normally to create your new Palm Profile. NOTE: If you find yourself unable to close the WiFi panel, remove the battery and reboot. Your phone will still connect to the network.

Bypassing modem errors

If your CDMA modem somehow gets into a bad state, firstuse will still fail with generic error messages (loading the "error" scene when it fails to initialize the modem).

Apparently changing (commenting out the isDevice line?)

function setUpFirstUse () {
setupSimulator (); 
// isDevice = true; 
}

and changing both instances of

if (PalmSystem.version.match("desktop")) {

to

if (true) {

will cause firstuse to use the same mechanism it does on the emulator and skip testing the CDMA modem.

FIXME: Would someone please validate this method and perhaps come up with a unified patch to solve both problems in fewer lines?

Credits

Courtesy of pEEf. Verified by Ajax.

Procedure with an bad ESN phone

The bad ESN phone (can be for example bought off eBay) is quite a good choice for a developer if you know how to get around the activation process. If you follow the 'good ESN' procedure, the phone will end at the "Profile Creation Failed" screen with no possibility to get around it.

NOTE: The following instructions were tested on webOS 1.1.0 and may not work on the later releases, but you can obtain the 1.1.0 Doctor and upgrade to a newer version using the Update app later (updated to 1.2.0, the phone works great).

Bypass the First Use app after booting

You can

  • use a developer ROM (Was available on Early Access, now offline. The updated public ROMs are still in the works.) with comparable functions with webOS 1.0.2 minus some profile-related stuff to get access to the phone while it's displaying the First Use app (and edit the file described below after the flashing) and then upgrade to a stock ROM. No need to edit the JAR file
  • reflash it with a modified stock ROM (the JAR packing and unpacking procedure is same as described above but with a different modified file). You need to edit the JAR file

Stock ROM procedure

If you modify the /etc/event.d/LunaSysMgr the following way (comment out some lines), the First Use app will not launch after the reboot and you'll be able to use the phone normally...kind of. The application requiring the Palm Profile may not work as the supposed to do until you continue with the 'Create a Palm Profile' procedure described below.

start on started java-serviceboot

# Stop when the Software Update tool is about to install an update.  The tool
# uses upstart to restart jobs when the installation is complete.
stop on started start_update

respawn

pre-start script
	echo "1" > /proc/sys/vm/overcommit_memory
	mkdir -p /var/luna/preferences
#	if [ ! -f /var/luna/preferences/ran-first-use ]
#	then
#		echo " -u minimal -a com.palm.app.firstuse" > /var/luna/preferences/sysmgr-args
#	else
		echo "" > /var/luna/preferences/sysmgr-args
#	fi	
end script

Developer ROM procedure

Just download the developer ROM from somewhere and flash the phone. Then you can do an update to the latest stock ROM by launching the Update application. You only need to create /var/luna/preferences/ran-first-use (touch /var/luna/preferences/ran-first-use command) file to be able to pass trough the First Use app after the boot, othervise you'll get stuck again ;-) One big catch: The system only shows version 1.1.0 as a maximal upgrade, it's currently not possible to update to 1.2.0+

NOTE: (confirmed on a clean reflashed phone two times) I've tried the developer ROM procedure (dev 1.0.2 => stock 1.1.0) and after the system update finished, my phone suddenly stopped responding to keyboard and touchscreen input though the remote access still worked. I discovered that there was some problem with installing the hidd (Human Interface Device Daemon aka touchscreen/keyboard/proximity sensor/accelerometer driver) libraries. If you also run accross this problem, you need to copy /usr/lib/lib/libhidkeypad.so and /usr/lib/libhidproximity.so from the webOS doctor image to the device. These files are missing and therefore the daemon cannot start.

Create a Palm Profile

You have to apply these changes from the remote shell (novaterm) directly on the running phone. Just update to the latest webOS version, enable the developer mode and connect to the device.

Procedure for both ROM types

This procedure has to be done either for the stock ROM and the developer ROM. You need to add the following two lines to /usr/palm/applications/com.palm.app.firstuse/app/controllers/provision-assistant.js file (webOS 1.1: line 50):

this.deviceIdRequest = AppAssistant.accountService.getDeviceId(
                            this.readDeviceId.bind(this),
                            this.deviceIdRequestFailed.bind(this), this.controller);

this.setupProgressBar();

this.provisionComplete(); // <==== add this line
return; // <==== add this line

ProvisionUtil.setScene(this);

if((!isActivated) && (activationFailed)) {

This modification will let you activate the phone without actually checking if it could be activated (you'll get Cannot Activate Your Phone screen if you don't do that).

Stock ROM procedure

No need to modify anything else. Just continue with the Finalization part.

Developer ROM procedure

If you're upgrading from the developer ROM, you need to modify the /dev/tokens/DMSETS file. in order to be able to create a Palm Profile. If you're running the stock ROM from the beginning, you don't have to issue this modification.

before modification:

{"sets":"94"}

after modification:

{"sets":"base"}

The phone will then think that it's not a developer device (for the sake of Profile creation process) and allow the Profile to be created.

Finally, you gotta kill the java (pkill java) and luna-prefs-service (pkill prefs) processes. When you do that, the phone will use load the edited DMSETS value and provide it to the Profile creation process.

Finalization

You have to install the SDK in order to be able to use the palm-launch command. After you issue one or both of the following modifications (stock ROM => only the first, dev ROM => both), you have to run the Firstuse app to create a Palm Profile. This can be done using the palm-launch com.palm.app.firstuse. The phone will launch the classical Firstuse app screen and let you create the Profile.

NOTE:: If the phone still complains about something, reboot it or try killing the java and prefs processes (as described in the previous step).

Finalization (Alternate Method)

I had trouble with the above 'Finalization' step and always got the error "Profile Creation Failed". Below is a manual method for creating a Palm account. Once you run it you should get an email from Palm to confirm your details.

I believe questionid 2 is "what is your first car" but you are asked this information again from the Palm email.

Replace the bold entries with your details, root to your Pre or Pixi and run the following command.

luna-send -n 1 palm://com.palm.accountservices/createNovaAccount {\"password\":\"YOURPASSWORD\",\"email\":\"YOUREMAIL@SOMEWHERE.com\",\"firstName\":\"YOURFIRSTNAME\",\"lastName\":\"YOURLASTNAME\",\"language\":\"en\",\"country\":\"gb\",\"QuestionId\":\"2\",\"response\":\"FIRSTCAR\"}

Credits

  • xxrake for the original PreCentral forums post
  • czechdev for finding out what the "Profile Creation Screen" does really mean and how to solve it, SDK to stock ROM update process
  • greg_roll added manual profile creation method
Personal tools
Google AdSense