Register Guidelines E-Books Search Today's Posts Mark Forums Read

Go Back   MobileRead Forums > E-Book Readers > Amazon Kindle > Kindle Developer's Corner

Notices

Reply
 
Thread Tools Search this Thread
Old 10-11-2012, 01:02 PM   #811
arikfunke
Enthusiast
arikfunke is an enigma wrapped up in a mystery.arikfunke is an enigma wrapped up in a mystery.arikfunke is an enigma wrapped up in a mystery.arikfunke is an enigma wrapped up in a mystery.arikfunke is an enigma wrapped up in a mystery.arikfunke is an enigma wrapped up in a mystery.arikfunke is an enigma wrapped up in a mystery.arikfunke is an enigma wrapped up in a mystery.arikfunke is an enigma wrapped up in a mystery.arikfunke is an enigma wrapped up in a mystery.arikfunke is an enigma wrapped up in a mystery.
 
Posts: 32
Karma: 41848
Join Date: Mar 2011
Device: iRex
Quote:
Originally Posted by ixtab View Post
Just go with Java 1.4, it works.
Ok, this is probably naive, but if JBPatch was written and compiled for K4 in Java 1.4 and K3 also uses Java 1.4, what is going to have to be adjusted? (Apart from the patches and UI.)

Early in this post you wrote that JBPatch would produce no effect if installed on K3... Clearly compiling is not the issue.
arikfunke is offline   Reply With Quote
Old 10-11-2012, 01:29 PM   #812
twobob
( ͡° ͜ʖ ͡°){ʇlnɐɟ ƃǝs}Týr
twobob ought to be getting tired of karma fortunes by now.twobob ought to be getting tired of karma fortunes by now.twobob ought to be getting tired of karma fortunes by now.twobob ought to be getting tired of karma fortunes by now.twobob ought to be getting tired of karma fortunes by now.twobob ought to be getting tired of karma fortunes by now.twobob ought to be getting tired of karma fortunes by now.twobob ought to be getting tired of karma fortunes by now.twobob ought to be getting tired of karma fortunes by now.twobob ought to be getting tired of karma fortunes by now.twobob ought to be getting tired of karma fortunes by now.
 
twobob's Avatar
 
Posts: 6,491
Karma: 5977000
Join Date: Jun 2012
Location: uti gratia usura (Yao ying da ying; Mo ying da yieng)
Device: PW-WIFI|K5-3G+WIFI| K4|K3-3G|DXG|K2| Rooted Nook Touch
Okay I just read the entire JB Patch wiki page. Again.

"No effect" in the sense that the various specific classes that you are trying to address would be different ones on the KK. so whilst JBPatch may go ahead and attempt to patch a bunch of non-existant files - the net result would be zero changes.

I'll just quote the very end of the page
Quote:
Developing new Patches

JBPatch is only a framework for patches, and everybody is more than welcome to develop new patches. I will happily include such patches into the base distribution, if they are found to be useful. Here is a minimal description of how the general procedure to develop a new patch could look like:
  1. Identify an aspect of the Kindle which can be improved.
  2. Find out where exactly the code pertaining to that aspect is located in the Java classes. This is arguably the most difficult part of the entire procedure, as it requires to reverse engineer the existing Java classes. A few hints about this are linked from the first post of the JBPatch thread, and a few more can be found on the Kindle Touch Hacking page.
  3. Write a minimal patch to change some functionality at the previously identified locations. This is the second-most difficult part of the procedure, and will probably require a few iterations to get it right. You may want to test your changes on your development computer first (by modifying the "TestCurrentGoal" JUnit class, and by verifying that the output looks correct indeed), and then to test it on the Kindle by copying the patch to the device and restarting it, while watching the JBPatch log (/tmp/jbpatch.log). Hint: don't worry about localization, or about configurability, at this point.
  4. Once your patch is working correctly, the difficult part is over. You can now turn to the localization aspects (to make the patch appear correctly in the user interface; that's pretty easy), and possibly to configuration as well. Allowing for configurable settings isn't terribly difficult, it just requires a few more lines of code. You can always look at the source code of existing patches for examples. The hyphenation patch is a particularly good example to see how localization works, but the Cover View patch, the TTS patch, or the margins patch may be worthwile as well.
  5. Announce your patch in the forum thread!
So that is what I draw this conclusion from.

I think that this is a very exciting development (It being for a 3) and there are some options for UI IMHO.

: )

Last edited by twobob; 10-11-2012 at 01:34 PM. Reason: links to make life easy for future readers.
twobob is offline   Reply With Quote
Old 10-11-2012, 02:37 PM   #813
ixtab
0x2A
ixtab ought to be getting tired of karma fortunes by now.ixtab ought to be getting tired of karma fortunes by now.ixtab ought to be getting tired of karma fortunes by now.ixtab ought to be getting tired of karma fortunes by now.ixtab ought to be getting tired of karma fortunes by now.ixtab ought to be getting tired of karma fortunes by now.ixtab ought to be getting tired of karma fortunes by now.ixtab ought to be getting tired of karma fortunes by now.ixtab ought to be getting tired of karma fortunes by now.ixtab ought to be getting tired of karma fortunes by now.ixtab ought to be getting tired of karma fortunes by now.
 
ixtab's Avatar
 
Posts: 2,903
Karma: 6677427
Join Date: Dec 2011
Device: K3, K4, K5, KPW, KPW2
Quote:
Originally Posted by arikfunke View Post
Ok, this is probably naive, but if JBPatch was written and compiled for K4 in Java 1.4 and K3 also uses Java 1.4, what is going to have to be adjusted? (Apart from the patches and UI.)

Early in this post you wrote that JBPatch would produce no effect if installed on K3... Clearly compiling is not the issue.
There are two issues:

First: the UI parts will not work, because the K3 does *not* include the common Swing classes, like JButton. Instead, Amazon decided to use their own replacements, like "KButton". But as said, this is not so important yet, and I really urge you to ignore the UI stuff for the time being.

Second: I simply don't know if the method to "hook" into the system is the same. As said, I only have a K5 at this moment, and I can only describe how it works on this system. The rest of this post will try to make this clear.

So, to start off at the very beginning...

How does JBPatch really work?
It works by modifying the binary code of class files, right before it is actually interpreted as bytecode. For an easier-to-understand example: suppose that the Kindle could only display text files. JBPatch would be the part that can modify text files after they are loaded, but before they are displayed. So, it could, for example, modify all occurences of "red" to return "blue" instead. When loading a file that contains information about Moscow, the text would then suddenly read something like "The Blue Square (Russian: Красная площадь, tr. Krásnaja Plóščaď; IPA: [ˈkrasnəjə ˈploɕːətʲ]) is a city square in Moscow, Russia".

Essentially, every patch does just this: it replaces some known parts of what it was given by something else. There could be another patch which would replace all mentions of "Square" by "Triangle"... well, you get the idea. Of course, it's slightly more technical, but yeah, that actually is the idea of how JBPatch works.

Why can JBPatch work at all?
This is really rather tough to explain, and it can't be done in one or two paragraphs here. Essentially, it has to do with the way that classes are loaded in Java, and with the fact that ClassLoaders are organized hierarchically. You can find all the required information by asking your favorite search engine about "classloader hierarchy java" or similar.

But in short, it's all about getting control (as early as possible) over the class loading procedure. In other words: the JBPatch ClassLoader (called PatchingClassLoader) will try to take control over all class loading, as soon as it is loaded (instantiated) itself.

How does the PatchingClassLoader take control?
This one is relatively easy. By using the Java Reflection API, the PatchingClassLoader can "hook" in between its own actual (parent) ClassLoader, and that ClassLoader's real parent ClassLoader (To make this clear: yes, it is "parasitically" hooking in between its own "parent" and "grandparent" classloader!) . This, in turn, means that all future classes which are requested to be loaded by the parent ClassLoader will now go through the PatchingClassLoader. And that's exactly what we want - and we need to take that control as early as possible.

How does JBPatch make sure that it gets control early enough?
This is really the crucial thing: getting control early enough. And it's also exactly the thing why I can't promise anything for JBPatch on devices where I have not tested it myself.

Because it doesn't make sense to list things that don't work... I will list the things that DO work.

On the Kindle Touch:
- the entire system is based on Concierge OSGi.
- /opt/amazon/ebook/bin/init.xargs contains the line "-Dch.ethz.iks.concierge.strictStartup=true"
- so just adding -istart jbpatch.jar as the first line is enough. That jar file must of course contain the relevant OSGi Bundle manifest entries, but that's easy.
- the jbpatch.jar file will be loaded as the very first file, and it will install the PatchingClassLoader as soon as it is loaded. This, in turn, allows JBPatch to control all subsequent class loading.

So, to summarize it all: to make JBPatch work on a different Firmware, you will need to (a) either verify that the method also works on that device, or (b) find another method to make it work on that device.

Even in case it doesn't lead to anything at all... I hope that the above information was informative.

Last edited by ixtab; 10-11-2012 at 03:22 PM.
ixtab is offline   Reply With Quote
Old 10-11-2012, 03:20 PM   #814
twobob
( ͡° ͜ʖ ͡°){ʇlnɐɟ ƃǝs}Týr
twobob ought to be getting tired of karma fortunes by now.twobob ought to be getting tired of karma fortunes by now.twobob ought to be getting tired of karma fortunes by now.twobob ought to be getting tired of karma fortunes by now.twobob ought to be getting tired of karma fortunes by now.twobob ought to be getting tired of karma fortunes by now.twobob ought to be getting tired of karma fortunes by now.twobob ought to be getting tired of karma fortunes by now.twobob ought to be getting tired of karma fortunes by now.twobob ought to be getting tired of karma fortunes by now.twobob ought to be getting tired of karma fortunes by now.
 
twobob's Avatar
 
Posts: 6,491
Karma: 5977000
Join Date: Jun 2012
Location: uti gratia usura (Yao ying da ying; Mo ying da yieng)
Device: PW-WIFI|K5-3G+WIFI| K4|K3-3G|DXG|K2| Rooted Nook Touch
it was
twobob is offline   Reply With Quote
Old 10-11-2012, 03:22 PM   #815
qlob
Horse
qlob ought to be getting tired of karma fortunes by now.qlob ought to be getting tired of karma fortunes by now.qlob ought to be getting tired of karma fortunes by now.qlob ought to be getting tired of karma fortunes by now.qlob ought to be getting tired of karma fortunes by now.qlob ought to be getting tired of karma fortunes by now.qlob ought to be getting tired of karma fortunes by now.qlob ought to be getting tired of karma fortunes by now.qlob ought to be getting tired of karma fortunes by now.qlob ought to be getting tired of karma fortunes by now.qlob ought to be getting tired of karma fortunes by now.
 
qlob's Avatar
 
Posts: 1,029
Karma: 7096675
Join Date: Apr 2012
Device: Kindle3G+WiFi
The K3 has /opt/amazon/ebook/bin/start.sh , i think... I think it contains the -i thingies and whatnot.... its been a while...
qlob is offline   Reply With Quote
Old 10-11-2012, 03:27 PM   #816
ixtab
0x2A
ixtab ought to be getting tired of karma fortunes by now.ixtab ought to be getting tired of karma fortunes by now.ixtab ought to be getting tired of karma fortunes by now.ixtab ought to be getting tired of karma fortunes by now.ixtab ought to be getting tired of karma fortunes by now.ixtab ought to be getting tired of karma fortunes by now.ixtab ought to be getting tired of karma fortunes by now.ixtab ought to be getting tired of karma fortunes by now.ixtab ought to be getting tired of karma fortunes by now.ixtab ought to be getting tired of karma fortunes by now.ixtab ought to be getting tired of karma fortunes by now.
 
ixtab's Avatar
 
Posts: 2,903
Karma: 6677427
Join Date: Dec 2011
Device: K3, K4, K5, KPW, KPW2
(removed)

Last edited by ixtab; 10-11-2012 at 06:00 PM.
ixtab is offline   Reply With Quote
Old 10-11-2012, 03:30 PM   #817
knc1
Embedded Cheerleader
knc1 ought to be getting tired of karma fortunes by now.knc1 ought to be getting tired of karma fortunes by now.knc1 ought to be getting tired of karma fortunes by now.knc1 ought to be getting tired of karma fortunes by now.knc1 ought to be getting tired of karma fortunes by now.knc1 ought to be getting tired of karma fortunes by now.knc1 ought to be getting tired of karma fortunes by now.knc1 ought to be getting tired of karma fortunes by now.knc1 ought to be getting tired of karma fortunes by now.knc1 ought to be getting tired of karma fortunes by now.knc1 ought to be getting tired of karma fortunes by now.
 
knc1's Avatar
 
Posts: 5,774
Karma: 5722276
Join Date: Feb 2012
Device: Too many.
This thing?
Attached Files
File Type: gz start.sh.gz (3.4 KB, 33 views)
knc1 is offline   Reply With Quote
Old 10-11-2012, 03:32 PM   #818
knc1
Embedded Cheerleader
knc1 ought to be getting tired of karma fortunes by now.knc1 ought to be getting tired of karma fortunes by now.knc1 ought to be getting tired of karma fortunes by now.knc1 ought to be getting tired of karma fortunes by now.knc1 ought to be getting tired of karma fortunes by now.knc1 ought to be getting tired of karma fortunes by now.knc1 ought to be getting tired of karma fortunes by now.knc1 ought to be getting tired of karma fortunes by now.knc1 ought to be getting tired of karma fortunes by now.knc1 ought to be getting tired of karma fortunes by now.knc1 ought to be getting tired of karma fortunes by now.
 
knc1's Avatar
 
Posts: 5,774
Karma: 5722276
Join Date: Feb 2012
Device: Too many.
Quote:
Originally Posted by ixtab View Post
Even in case it doesn't lead to anything at all... I hope that the above information was informative.
Oh how quickly we forget even are own posts.
knc1 is offline   Reply With Quote
Old 10-11-2012, 03:41 PM   #819
ixtab
0x2A
ixtab ought to be getting tired of karma fortunes by now.ixtab ought to be getting tired of karma fortunes by now.ixtab ought to be getting tired of karma fortunes by now.ixtab ought to be getting tired of karma fortunes by now.ixtab ought to be getting tired of karma fortunes by now.ixtab ought to be getting tired of karma fortunes by now.ixtab ought to be getting tired of karma fortunes by now.ixtab ought to be getting tired of karma fortunes by now.ixtab ought to be getting tired of karma fortunes by now.ixtab ought to be getting tired of karma fortunes by now.ixtab ought to be getting tired of karma fortunes by now.
 
ixtab's Avatar
 
Posts: 2,903
Karma: 6677427
Join Date: Dec 2011
Device: K3, K4, K5, KPW, KPW2
Quote:
Originally Posted by knc1 View Post
Oh how quickly we forget even are own posts.
I admit that...

I don't understand a thing.

ixtab is offline   Reply With Quote
Old 10-11-2012, 03:52 PM   #820
knc1
Embedded Cheerleader
knc1 ought to be getting tired of karma fortunes by now.knc1 ought to be getting tired of karma fortunes by now.knc1 ought to be getting tired of karma fortunes by now.knc1 ought to be getting tired of karma fortunes by now.knc1 ought to be getting tired of karma fortunes by now.knc1 ought to be getting tired of karma fortunes by now.knc1 ought to be getting tired of karma fortunes by now.knc1 ought to be getting tired of karma fortunes by now.knc1 ought to be getting tired of karma fortunes by now.knc1 ought to be getting tired of karma fortunes by now.knc1 ought to be getting tired of karma fortunes by now.
 
knc1's Avatar
 
Posts: 5,774
Karma: 5722276
Join Date: Feb 2012
Device: Too many.
Quote:
Originally Posted by ixtab View Post
I admit that...

I don't understand a thing.

Probably because compliments are so rare on a technical forum.
It sort-of "blind sided" you.
knc1 is offline   Reply With Quote
Old 10-12-2012, 05:10 AM   #821
arikfunke
Enthusiast
arikfunke is an enigma wrapped up in a mystery.arikfunke is an enigma wrapped up in a mystery.arikfunke is an enigma wrapped up in a mystery.arikfunke is an enigma wrapped up in a mystery.arikfunke is an enigma wrapped up in a mystery.arikfunke is an enigma wrapped up in a mystery.arikfunke is an enigma wrapped up in a mystery.arikfunke is an enigma wrapped up in a mystery.arikfunke is an enigma wrapped up in a mystery.arikfunke is an enigma wrapped up in a mystery.arikfunke is an enigma wrapped up in a mystery.
 
Posts: 32
Karma: 41848
Join Date: Mar 2011
Device: iRex
Quote:
Originally Posted by ixtab View Post
On the Kindle Touch:
- the entire system is based on Concierge OSGi.
Thanks for the extensive explanation. As far as I can tell, K3 does not use OSGi. (Maybe somebody can confirm this?)

If that is indeed the case, I imagine, the JBPatch code would require some more extensive adaptation for the patching class loader to work on K3, right?

In case it helps, on K3 the framework is started as follows:

jvm_opt="$jvm_heap_options \
-Dsun.awt.exception.handler=$EVENT_QUEUE_EXCEPTION_ HANDLER \
-Xbootclasspath/a:$java_locale_data:$java_charset_data \
-Dsun.boot.library.path=$java_home/lib \
-cp $clazzpath:$ebook_home/lib/portability-impl.jar"

app_opt="
-Ddebug=1 \
-Dcheck_comm_stack=true \
-Dsun.net.client.defaultReadTimeout=120000 \
-Dhttp.keepalive.timeout=60000 \
-DUI_TIMEOUT=0 \
-Dhttp.maxConnections=16 \
-Dallow_demo=false \
-Djava.awt.SyncOnPaint=false \
-Dextkeyboard=false \
-Dconfig=$configdir/framework.luigi.conf \
-DPLATFORM_CLASS_FILE=/opt/amazon/ebook/config/platform.conf \
-DENABLE_SEARCH_INDEXING_THREAD=true \
-Dpolicy.home=$securitydir \
-Djava.security.manager \
-Djava.awt.DebugPaint=false \
-DUSE_KWGRAPHICS=false"

opts="$jvm_opt $jit_opt $jvmpihprof_opt $jvmtihprof_opt $debug_opt $app_opt"

app=com.lab126.linux.arm.LuigiServiceProvider

LD_PRELOAD=$java_home/lib/libmicrowindowsawt.so $java $opts $app 2>&1


List of java archive files on the device:
[root@kindle ebook]# find / -name *.jar
/opt/amazon/ebook/booklet/XymlBooklet.jar
/opt/amazon/ebook/booklet/Search.jar
/opt/amazon/ebook/booklet/PictureViewer.jar
/opt/amazon/ebook/booklet/AudioPlayer.jar
/opt/amazon/ebook/booklet/MobiReader.jar
/opt/amazon/ebook/booklet/msp.jar
/opt/amazon/ebook/booklet/AudiblePlayer.jar
/opt/amazon/ebook/booklet/Home.jar
/opt/amazon/ebook/booklet/Browser.jar
/opt/amazon/ebook/booklet/KindletBooklet-1.2.jar
/opt/amazon/ebook/booklet/language.jar
/opt/amazon/ebook/sdk/lib/xercesImpl.jar
/opt/amazon/ebook/sdk/lib/log4j-1.2.15.jar
/opt/amazon/ebook/sdk/lib/xml-apis.jar
/opt/amazon/ebook/lib/framework-impl.jar
/opt/amazon/ebook/lib/json_simple-1.1.jar
/opt/amazon/ebook/lib/KindleDeviceServicesAbstraction-1.0.jar
/opt/amazon/ebook/lib/framework-api.jar
/opt/amazon/ebook/lib/JFEP-0.1.0.jar
/opt/amazon/ebook/lib/xyml.jar
/opt/amazon/ebook/lib/utilities.jar
/opt/amazon/ebook/lib/MobipocketCoreReader.jar
/opt/amazon/ebook/lib/jdbm.jar
/opt/amazon/ebook/lib/KindleDeviceServicesShasta-1.0.jar
/opt/amazon/ebook/lib/lucene-analyzers-2.4.1.jar
/opt/amazon/ebook/lib/portability-impl.jar
/opt/amazon/ebook/lib/KindletImplementation-1.2.jar
/opt/amazon/ebook/lib/ReaderSDK.jar
/opt/amazon/ebook/lib/portability.jar
/opt/amazon/ebook/lib/icu4j.jar
/opt/amazon/ebook/lib/lucene-snowball-2.4.1.jar
/opt/amazon/ebook/lib/lucene-core-2.4.1.jar
/opt/amazon/ebook/lib/kxml2.jar
/opt/amazon/ebook/lib/PDFReader-impl.jar
/opt/amazon/ebook/lib/SearchSDK.jar
/opt/amazon/ebook/lib/KindleGUIAbstraction-1.0.jar
/opt/amazon/ebook/lib/KindleGUIShasta-1.0.jar
/opt/amazon/ebook/lib/backport-util-concurrent-3.1.jar
/opt/amazon/ebook/lib/MobiCore-impl.jar
/opt/amazon/ebook/lib/Kindlet-1.2.jar
/opt/amazon/ebook/lib/json.jar
/opt/amazon/ebook/lib/booklet.jar
/opt/amazon/ebook/lib/KindletBookletDRM-1.0.jar
/opt/amazon/ebook/lib/kindlePageNumbersDeviceReader.jar
/opt/amazon/ebook/lib/Journal-update.jar
/opt/amazon/ebook/lib/mobi8sdk.jar
/opt/amazon/ebook/lib/HTMLReader-impl.jar
/usr/java/lib/jaas.jar
/usr/java/lib/sunrsasign.jar
/usr/java/lib/charsets.jar
/usr/java/lib/security/local_policy.jar
/usr/java/lib/security/US_export_policy.jar
/usr/java/lib/localedata.jar
/usr/java/lib/jce.jar
/usr/java/lib/jsse-cdc.jar
/usr/java/lib/ext/sunjce_provider.jar
/usr/java/lib/basis.jar
arikfunke is offline   Reply With Quote
Old 10-12-2012, 06:37 AM   #822
knc1
Embedded Cheerleader
knc1 ought to be getting tired of karma fortunes by now.knc1 ought to be getting tired of karma fortunes by now.knc1 ought to be getting tired of karma fortunes by now.knc1 ought to be getting tired of karma fortunes by now.knc1 ought to be getting tired of karma fortunes by now.knc1 ought to be getting tired of karma fortunes by now.knc1 ought to be getting tired of karma fortunes by now.knc1 ought to be getting tired of karma fortunes by now.knc1 ought to be getting tired of karma fortunes by now.knc1 ought to be getting tired of karma fortunes by now.knc1 ought to be getting tired of karma fortunes by now.
 
knc1's Avatar
 
Posts: 5,774
Karma: 5722276
Join Date: Feb 2012
Device: Too many.
Quote:
Originally Posted by arikfunke View Post
Thanks for the extensive explanation. As far as I can tell, K3 does not use OSGi. (Maybe somebody can confirm this?)

If that is indeed the case, I imagine, the JBPatch code would require some more extensive adaptation for the patching class loader to work on K3, right?

In case it helps, on K3 the framework is started as follows:
- - - snip - - -
Which looks to be an excerpt from the attachment to post 817 above.

Except that in the actual script, the jar search is restricted to three directories, not what was used to produce the list snipped from this quote.
knc1 is offline   Reply With Quote
Old 10-12-2012, 06:42 AM   #823
ixtab
0x2A
ixtab ought to be getting tired of karma fortunes by now.ixtab ought to be getting tired of karma fortunes by now.ixtab ought to be getting tired of karma fortunes by now.ixtab ought to be getting tired of karma fortunes by now.ixtab ought to be getting tired of karma fortunes by now.ixtab ought to be getting tired of karma fortunes by now.ixtab ought to be getting tired of karma fortunes by now.ixtab ought to be getting tired of karma fortunes by now.ixtab ought to be getting tired of karma fortunes by now.ixtab ought to be getting tired of karma fortunes by now.ixtab ought to be getting tired of karma fortunes by now.
 
ixtab's Avatar
 
Posts: 2,903
Karma: 6677427
Join Date: Dec 2011
Device: K3, K4, K5, KPW, KPW2
Quote:
Originally Posted by arikfunke View Post
Thanks for the extensive explanation. As far as I can tell, K3 does not use OSGi. (Maybe somebody can confirm this?)

If that is indeed the case, I imagine, the JBPatch code would require some more extensive adaptation for the patching class loader to work on K3, right?

In case it helps, on K3 the framework is started as follows:

app=com.lab126.linux.arm.LuigiServiceProvider
The easiest solution may be to simply overwrite the main class (com.lab126.linux.arm.LuigiServiceProvider) in start.sh with, say, com.mobileread.ixtab.jbpatch.bootstrap.Startup (or so). This class would do all the required wiring, and then call the LuigiServiceProvider main() method.

Should be about 10 lines of code...
ixtab is offline   Reply With Quote
Old 10-12-2012, 07:08 AM   #824
ixtab
0x2A
ixtab ought to be getting tired of karma fortunes by now.ixtab ought to be getting tired of karma fortunes by now.ixtab ought to be getting tired of karma fortunes by now.ixtab ought to be getting tired of karma fortunes by now.ixtab ought to be getting tired of karma fortunes by now.ixtab ought to be getting tired of karma fortunes by now.ixtab ought to be getting tired of karma fortunes by now.ixtab ought to be getting tired of karma fortunes by now.ixtab ought to be getting tired of karma fortunes by now.ixtab ought to be getting tired of karma fortunes by now.ixtab ought to be getting tired of karma fortunes by now.
 
ixtab's Avatar
 
Posts: 2,903
Karma: 6677427
Join Date: Dec 2011
Device: K3, K4, K5, KPW, KPW2
Quote:
Originally Posted by ixtab View Post
The easiest solution may be to simply overwrite the main class (com.lab126.linux.arm.LuigiServiceProvider) in start.sh with, say, com.mobileread.ixtab.jbpatch.bootstrap.K3Startup (or so). This class would do all the required wiring, and then call the LuigiServiceProvider main() method.

Should be about 10 lines of code...
Here's some code:

Code:
package com.mobileread.ixtab.jbpatch.bootstrap;

import java.lang.reflect.Method;

public class K3Startup {

	public static void main(String[] args) {
		try {
			// set up JBPatch classloader
			PatchingClassLoader.inject();
			new Stage2().run();
			
			// invoke "real" startup class
			Class startup = Class.forName("com.lab126.linux.arm.LuigiServiceProvider");
			Method main = startup.getMethod("main", new Class[] {String[].class});
			main.invoke(null, new Object[] {args});
		} catch (Throwable t) {
			t.printStackTrace();
		}
		
	}

}
Give this a try, it might even work

Of course, this requires the framework startup script to be changed to use com.mobileread.ixtab.jbpatch.bootstrap.K3Startup as the main class, and the jbpatch jar to be in the classpath (I suggest /opt/amazon/ebook/lib/jbpatch.jar)

If the framework starts up normally, you can then check /tmp/jbpatch.log to see if JBPatch is working correctly.

Last edited by ixtab; 10-23-2012 at 02:16 PM.
ixtab is offline   Reply With Quote
Old 10-12-2012, 08:21 AM   #825
arikfunke
Enthusiast
arikfunke is an enigma wrapped up in a mystery.arikfunke is an enigma wrapped up in a mystery.arikfunke is an enigma wrapped up in a mystery.arikfunke is an enigma wrapped up in a mystery.arikfunke is an enigma wrapped up in a mystery.arikfunke is an enigma wrapped up in a mystery.arikfunke is an enigma wrapped up in a mystery.arikfunke is an enigma wrapped up in a mystery.arikfunke is an enigma wrapped up in a mystery.arikfunke is an enigma wrapped up in a mystery.arikfunke is an enigma wrapped up in a mystery.
 
Posts: 32
Karma: 41848
Join Date: Mar 2011
Device: iRex
Quote:
Originally Posted by ixtab View Post
Give this a try, it might even work

Of course, this requires the framework startup script to be changed to use com.mobileread.ixtab.jbpatch.bootstrap.K3Startup as the main class, and the jbpatch jar to be in the classpath (I suggest /opt/amazon/ebook/lib/jbpatch.jar)
Sounds easy enough. I will give it a try. Am I right to assume that bootstrap/stage1.class won't be needed in this case? It produces compile errors due to the missing osgi dependencies.
arikfunke is offline   Reply With Quote
Reply

Tags
jbpatch, kindle touch hacks

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Forum Jump


All times are GMT -4. The time now is 06:28 AM.


MobileRead.com is a privately owned, operated and funded community.