Big thanks for adq and his lj entries.
All what I'll write I tested on my Kindle 3 wifi only.
Your must have jailbreaked Kindle to do this, have some skills with Linux systems and with Java.
- First of all, we need get KDK jars files. You can copy it from your Kindle. Main KDK jar is located at /opt/amazon/ebook/lib/Kindlet-1.1.jar. Also you can pull off all jars from /opt/amazon/ebook/lib and /opt/amazon/ebook/sdk/lib folders.
- Create Java project in your fav IDE ( I use NetBeans ). Add Kindlet-1.1.jar as library to your project ( depends from your IDE ). Hello World Example Kindlet is under spoiler. You would be able to compile it at this step.
- You must change Manifest file in your project. It's depends from you IDE also. You must add this lines to it:
Code:
Implementation-Title: Your_App_Name
Implementation-Version: Your_App_Verion
Implementation-Vendor: Your_Name
Don't forget change lines with your data.
At this step, we have jar file with valid Manifest file. You can try change filename from *.jar to *.azw2, copy it into documents folder on USB mass storage and run, but you wouldn't be able do this. This is normal.
Note, that you can check manifest, unzip jar file and see it in META-INF folder.
- Create own keystore with pairs of keys for signing own kindlets. "keytool" helps us. For creating keystore execute this commands:
Code:
keytool -genkeypair -keystore developer.keystore -storepass YOURPASS_FOR_STORE -keypass YOURPASS_FOR_KEY -alias dkYOUR_ALIAS -dname "CN=Unknown, OU=Unknown, O=Unknown, L=Unknown, ST=Unknown, C=Unknown" -validity 5300
keytool -genkeypair -keystore developer.keystore -storepass YOURPASS_FOR_STORE -keypass YOURPASS_FOR_KEY -alias diYOUR_ALIAS -dname "CN=Unknown, OU=Unknown, O=Unknown, L=Unknown, ST=Unknown, C=Unknown" -validity 5300
keytool -genkeypair -keystore developer.keystore -storepass YOURPASS_FOR_STORE -keypass YOURPASS_FOR_KEY -alias dnYOUR_ALIAS -dname "CN=Unknown, OU=Unknown, O=Unknown, L=Unknown, ST=Unknown, C=Unknown" -validity 5300
Note, that dk, di and dn suffixes in aliases is necessary.
Alias is case-insensitive. For example:
Code:
keytool -genkeypair -keystore developer.keystore -storepass passwork -keypass password -alias dnTest -dname "CN=Unknown, OU=Unknown, O=Unknown, L=Unknown, ST=Unknown, C=Unknown" -validity 5300
- Copy this keystore to /var/local/java/keystore/developer.keystore
- Sign jar file executing this command:
Code:
jarsigner -keystore KEYSTORE_FILE -storepass KEYSTORE_PASS JAR_FILE dkYOUR_ALIAS
jarsigner -keystore KEYSTORE_FILE -storepass KEYSTORE_PASS JAR_FILE diYOUR_ALIAS
jarsigner -keystore KEYSTORE_FILE -storepass KEYSTORE_PASS JAR_FILE dnYOUR_ALIAS
For example:
Code:
jarsigner -keystore develop.keystore -storepass password ~/projects/test/dist/test.jar dnTest
- Copy signed jar into Kindle, rename it to *.azw2, and try to run.
Note, that you must restart your Kindle after copying develop.keystore to it.
P.S. If you want to know more, you can read adq's entries in his
LiveJournal about this.
P.S.S. I suggest create one public develop.keystore, and sign all free apps. It prevents problem with apps from different developers. Or how can I merge keystore from another developer with mine?