rm -rf /
Posts: 219
Karma: 3333683
Join Date: Nov 2019
Location: United Kingdom
Device: K5, KT, KT2, KT3, KT4, KV, PW2, PW3, PW4, PW5
|
Quote:
Originally Posted by NiLuJe
You'd need a patched initrd for that (c.f., @katadelos' previous post on that front  ) (and explicitly flag the package with the right key number but our actual JB key, because I don't think the updater even supports the dev key index).
All of that *should* be doable via KindleTool, but, obviously, has never been tested (to my knowledge)  .
|
Pretty much this - once the initrd thing is out of the way, it's not particularly difficult to create a self-signed update that will successfully install. I've tested this in the past but can't find the exact KindleTool args that I used to create the update
I had a look and managed to find the script that I was using to patch recovery-util, it's just a simple find and replace:
Spoiler:
Code:
exponent = [0x01, 0x00, 0x01]
test = [0x00, 0xbc, 0x03, 0x06, 0x30, 0x30, 0x2d, 0x81, 0x82, 0x89, 0xdf, 0xaf, 0xda, 0x24, 0x9d, 0x31, 0x1e, 0xe9, 0x6f, 0x4f, 0xab, 0xb0, 0xc2, 0xb7, 0xb4, 0x42, 0xb9, 0xd0, 0x59, 0x88, 0x51, 0xa3, 0x30, 0xc7, 0xe8, 0xac, 0x2a, 0xbb, 0xec, 0xcd, 0x81, 0x48, 0xfe, 0xfb, 0x61, 0x5d, 0xd7, 0xa0, 0x73, 0x94, 0xbf, 0xa9, 0xb6, 0x61, 0x9e, 0x7e, 0x74, 0x21, 0x88, 0xaa, 0x61, 0x70, 0x10, 0x4d, 0x1d, 0x73, 0xb4, 0x61, 0xe1, 0xc0, 0x45, 0x8d, 0xfa, 0xc6, 0xa8, 0x37, 0x8f, 0x96, 0xc6, 0xbc, 0xe9, 0x36, 0x80, 0xd1, 0x7e, 0xaa, 0xfc, 0x0a, 0xa0, 0x35, 0xe3, 0xf2, 0x39, 0x53, 0x23, 0x35, 0x32, 0x88, 0x4a, 0x7d, 0x35, 0xd9, 0xbb, 0xb8, 0xbf, 0x64, 0x19, 0x75, 0xbd, 0xba, 0x77, 0x35, 0x1e, 0x14, 0x80, 0xd9, 0x7a, 0x71, 0xf3, 0x37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71, 0xdd, 0xb0, 0x5c, 0x9a, 0xb5, 0x5e, 0x2b,
0x61, 0xe0, 0x15, 0x4f, 0x4a, 0x54, 0x7d, 0x55, 0xe7, 0x93,
0x31, 0x41, 0x4e, 0x3d, 0xf1, 0xc6, 0xb7, 0x6f, 0x2c, 0xd2,
0x20, 0xa6, 0x5d, 0xfc, 0x2a, 0xa4, 0xfc, 0x50, 0x6b, 0x62,
0xbe, 0x80, 0xf5, 0x22, 0xcc, 0x7f, 0x2a, 0x56, 0xd5, 0x4f,
0xe4, 0x60, 0xe6, 0xae, 0x4a, 0xfd, 0x21, 0xe6, 0x4e, 0x61,
0xa0, 0x8b, 0x18, 0x6a, 0xd3, 0x4f, 0x10, 0xc5, 0x50, 0x49,
0x41, 0xf3, 0xc6, 0x67, 0xae, 0xff, 0x17, 0x85, 0xd5, 0x67,
0x6d, 0x3f, 0xaa, 0x7a, 0x74, 0x0c, 0xaf, 0xef, 0xb7, 0xf0,
0x07, 0xc0, 0xc6, 0x0c, 0x23, 0xe1, 0x02, 0x8b, 0x8d, 0xdf,
0x9b, 0x53, 0xeb, 0x1f, 0xd7, 0x76, 0x87]
#pubprodkey1 = bytes(pubprodkey1_n + exponent)
#pubprodkey2 = bytes(pubprodkey2_n + exponent)
#jailbreak_k_2 = bytes(test + exponent)
#jailbreak_k_1 = bytes(jailbreak_pub + exponent)
pubprodkey1 = bytes(pubprodkey1_n)
pubprodkey2 = bytes(pubprodkey2_n)
jailbreak_k_2 = bytes(test)
jailbreak_k_1 = bytes(jailbreak_pub)
with open("recovery-util", 'rb') as original:
original_bytes = original.read()
with open("recovery-util-patch", 'wb') as patched:
print(pubprodkey1 in original_bytes)
k1 = original_bytes.replace(pubprodkey2, jailbreak_k_2)
k2 = k1.replace(pubprodkey1, jailbreak_k_1)
patched.write(k2)
patched.close()
original.close()
|