02-20-2013, 12:00 PM | #16 |
Going Viral
Posts: 17,212
Karma: 18210809
Join Date: Feb 2012
Location: Central Texas
Device: No K1, PW2, KV, KOA
|
|
02-20-2013, 12:21 PM | #17 |
( ͡° ͜ʖ ͡°){ʇlnɐɟ ƃǝs}Týr
Posts: 6,586
Karma: 6299991
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
|
This is an extremely thorough one-man effort.
Respect. (insert lab126 bashing statements here) |
02-20-2013, 12:41 PM | #18 |
Going Viral
Posts: 17,212
Karma: 18210809
Join Date: Feb 2012
Location: Central Texas
Device: No K1, PW2, KV, KOA
|
K4 Diag Specifics (from the binary)
Having learned a bit from the 'main' kernel - - -
Assume that the diags kernel came out of the same build process as the main kernel, see if we can get lucky finding the dot-config file. The kernel uses gzip compression for the dot-config file, so search for those magic numbers: Spoiler:
Try the last one found: Spoiler:
Yup - that is the kernel dot-config file. Attach a copy of it here. Code:
core2quad diags $ mv kd-4.0-99 dot-config-diags-4.0 core2quad diags $ gzip dot-config-diags-4.0 Code:
CONFIG_BLK_DEV_INITRD=y CONFIG_INITRAMFS_SOURCE="initramfs.list" CONFIG_INITRAMFS_ROOT_UID=0 CONFIG_INITRAMFS_ROOT_GID=0 CONFIG_RD_GZIP=y # CONFIG_RD_BZIP2 is not set # CONFIG_RD_LZMA is not set CONFIG_INITRAMFS_COMPRESSION_NONE=y # CONFIG_INITRAMFS_COMPRESSION_GZIP is not set # CONFIG_INITRAMFS_COMPRESSION_BZIP2 is not set # CONFIG_INITRAMFS_COMPRESSION_LZMA is not set Trim the known, compressed, dot-config off of the kernel image: Code:
core2quad diags $ dd if=kernel_diags_4.0.img bs=1 count=3853332 of=kd-trim.bin 3853332+0 records in 3853332+0 records out 3853332 bytes (3.9 MB) copied, 14.889 s, 259 kB/s Spoiler:
Maybe we can get lucky, and it is the first one: Code:
core2quad diags $ od -A d -t x1 kd-trim.bin | grep '30 37 30 37 30 31' 0102560 30 37 30 37 30 31 30 30 30 30 30 32 44 31 30 30 core2quad diags $ dd if=kd-trim.bin bs=1 skip=102560 of=kd-trim-00.cpio 3750772+0 records in 3750772+0 records out 3750772 bytes (3.8 MB) copied, 14.8647 s, 252 kB/s core2quad diags $ file kd-trim-00.cpio kd-trim-00.cpio: ASCII cpio archive (SVR4 with no CRC) core2quad diags $ mkdir cpio core2quad diags $ cd cpio core2quad cpio $ sudo su core2quad cpio # cpio -i -d -m --no-absolute-filenames -I ../kd-trim-00.cpio cpio: Removing leading `/' from member names 1920 blocks core2quad cpio # ls -l total 28 drwxr-xr-x 2 root root 4096 2013-02-20 12:24 bin drwxr-xr-x 7 root root 4096 2013-02-20 12:24 dev lrwxrwxrwx 1 root root 18 2013-02-20 12:24 init -> /bin/recovery-util drwxr-xr-x 3 root root 4096 2013-02-20 12:24 lib drwxr-xr-x 3 root root 4096 2013-02-20 12:24 mnt drwxr-xr-x 2 root root 4096 2011-09-02 21:00 proc drwx------ 2 root root 4096 2011-09-02 21:00 root drwxr-xr-x 2 root root 4096 2011-09-02 21:00 sys Last edited by knc1; 02-21-2013 at 08:03 PM. |
02-20-2013, 12:51 PM | #19 | |
Going Viral
Posts: 17,212
Karma: 18210809
Join Date: Feb 2012
Location: Central Texas
Device: No K1, PW2, KV, KOA
|
Quote:
I found a very complete, keystroke by keystroke, HowTo de-compose a binary kernel image on: http://MiniModding.com |
|
02-20-2013, 01:13 PM | #20 | |
( ͡° ͜ʖ ͡°){ʇlnɐɟ ƃǝs}Týr
Posts: 6,586
Karma: 6299991
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
|
Quote:
Which. I might add... is running VERY nicely now I now note... *time to shift some articles across soon I think therefore* Topness!! |
|
02-20-2013, 02:58 PM | #21 | |
Evangelist
Posts: 404
Karma: 2200000
Join Date: May 2012
Device: kt
|
Quote:
Spoiler:
|
|
02-20-2013, 05:23 PM | #22 | |
Going Viral
Posts: 17,212
Karma: 18210809
Join Date: Feb 2012
Location: Central Texas
Device: No K1, PW2, KV, KOA
|
Quote:
|
|
02-20-2013, 06:14 PM | #23 |
Going Viral
Posts: 17,212
Karma: 18210809
Join Date: Feb 2012
Location: Central Texas
Device: No K1, PW2, KV, KOA
|
K5 specifics (from the binaries)
Our collection of config files and initramfs directory trees is at:
DX(G) - 2.5.8 https://www.mobileread.com/forums/sho...5&postcount=31 K3 - 3.4 https://www.mobileread.com/forums/sho...3&postcount=11 K4 - 4.1.0 (with a 4.0 diags thrown in for flavor): https://www.mobileread.com/forums/sho...5&postcount=10 Working towards having a collection that covers the same devices that KUAL will run on (for add-in module building); The K5 specifics next. With lots, and lots of command examples for those who want something I don't do myself already posted, from now on I'll spoiler them. Continued by: K5pw, main-5.2.0: https://www.mobileread.com/forums/sho...2&postcount=24 K5pw, diags-5.2.0: https://www.mobileread.com/forums/sho...0&postcount=25 K5pw, main-5.3.0: https://www.mobileread.com/forums/sho...3&postcount=30 K5touch, main-5.0.0: https://www.mobileread.com/forums/sho...8&postcount=26 K5touch, diags-5.0.0: https://www.mobileread.com/forums/sho...5&postcount=28 K5touch, main-5.1.2: https://www.mobileread.com/forums/sho...9&postcount=29 Last edited by knc1; 02-21-2013 at 06:28 PM. |
02-21-2013, 11:03 AM | #24 |
Going Viral
Posts: 17,212
Karma: 18210809
Join Date: Feb 2012
Location: Central Texas
Device: No K1, PW2, KV, KOA
|
K5pw, main-5.2.0
The kernel uses gzip compression for the dot-config.
It is the last thing concatenated to the image by the kernel build system, although the builder may have concatenated other things afterwards (some distro's put their splash image after the dot-config). Search for the gzip magic number, assume for first try that the dot-config is the last such signature: Spoiler:
In the previous posts, we have seen the 'trailing garbage ignored' message from gunzip. This might be anything, from a single byte of padding to a very large chunk of something else. In this case, 4Mbytes is a bit too large for a compressed configuration file! Investigate what gunzip thinks is the contents of the file: Code:
core2quad main $ gunzip -l -v km_config-5.2.0.gz method crc date time compressed uncompressed ratio uncompressed_name defla ffffffff Feb 21 08:18 4078636 4294967295 99.9% km_config-5.2.0 core2quad main $ zcat km_config-5.2.0.gz > km_config-5.2.0-00 gzip: km_config-5.2.0.gz: decompression OK, trailing garbage ignored core2quad main $ file km_config-5.2.0-00 km_config-5.2.0-00: data core2quad main $ ls -l km_config-5.2.0-00 -rw-rw-r-- 1 mszick mszick 194572 2013-02-21 09:09 km_config-5.2.0-00 Try searching for an initramFS in 'cpio -H newc' format: Spoiler:
Knowing that every file in a cpio archive has the same header magic, start with the earliest one in the file: Code:
core2quad main $ od -A d -t x1 km-5.2.0.img | grep '30 37 30 37 30 31' 0102368 30 37 30 37 30 31 30 30 30 30 30 32 44 31 30 30 core2quad main $ dd if=km-5.2.0.img bs=1 skip=102368 of=km-5.2.0-irfs.cpio 4506656+0 records in 4506656+0 records out 4506656 bytes (4.5 MB) copied, 18.6441 s, 242 kB/s You **must** be 'root' to copy permissions and ownership, also to create special files. You **must** use the '--no-absolute-filename' option to prevent trashing your work station! Spoiler:
Attached below. |
02-21-2013, 11:31 AM | #25 |
Going Viral
Posts: 17,212
Karma: 18210809
Join Date: Feb 2012
Location: Central Texas
Device: No K1, PW2, KV, KOA
|
K5pw, diags-5.2.0
A little bit of prep work.
Spoiler:
The last gzip signature is too far away from the end-of-file for this image to have an attached dot-config file. Moving right along, try to pull an initramfs (irfs) 'cpio -H newc' archive off of the image. Spoiler:
No attached dot-config but initramfs (irfs) attached here. |
02-21-2013, 12:25 PM | #26 |
Going Viral
Posts: 17,212
Karma: 18210809
Join Date: Feb 2012
Location: Central Texas
Device: No K1, PW2, KV, KOA
|
K5touch, main-5.0.0
The search continues for dot-config files with a little bit of prep work.
Spoiler:
That one may have a dot-config file on the end of it Spoiler:
Got one! Code:
core2quad main $ mv km-5.0.0-dc dot-config-main-5.0.0 core2quad main $ gzip dot-config-main-5.0.0 Code:
core2quad main $ dd if=km-5.0.0.img bs=1 count=3817916 of=km-5.0.0-trim.img 3817916+0 records in 3817916+0 records out 3817916 bytes (3.8 MB) copied, 16.3716 s, 233 kB/s Spoiler:
Both recovered files attached here. |
02-21-2013, 01:01 PM | #27 |
( ͡° ͜ʖ ͡°){ʇlnɐɟ ƃǝs}Týr
Posts: 6,586
Karma: 6299991
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
|
: ) This is now officially my favourite "it's got what now?" thread.
Herculean. I am thinking this will REALLY help when doing the OTG USB work. |
02-21-2013, 01:48 PM | #28 |
Going Viral
Posts: 17,212
Karma: 18210809
Join Date: Feb 2012
Location: Central Texas
Device: No K1, PW2, KV, KOA
|
K5touch, diags-5.0.0
The search continues for dot-config files with a little bit of prep work.
Spoiler:
That one should also have a dot-config file on the end of it Spoiler:
Got one! Code:
core2quad diags $ mv kd-5.0.0-dc dot-config-diags-5.0.0 core2quad diags $ gzip dot-config-diags-5.0.0 Code:
core2quad diags $ dd if=kd-5.0.0.img bs=1 count=3853524 of=kd-5.0.0-trim.img 3853524+0 records in 3853524+0 records out 3853524 bytes (3.9 MB) copied, 15.9202 s, 242 kB/s Spoiler:
Both recovered files attached here. |
02-21-2013, 04:25 PM | #29 |
Going Viral
Posts: 17,212
Karma: 18210809
Join Date: Feb 2012
Location: Central Texas
Device: No K1, PW2, KV, KOA
|
K5touch, main-5.1.2
The search continues for dot-config files with a little bit of prep work.
Spoiler:
That one should also have a dot-config file on the end of it Spoiler:
Got one! Code:
core2quad main $ mv km-5.1.2-dc dot-config-main-5.1.2 core2quad main $ gzip dot-config-main-5.1.2 Code:
core2quad main $ dd if=km-5.1.2.img bs=1 count=3889924 of=km-5.1.2-trim.img 3889924+0 records in 3889924+0 records out 3889924 bytes (3.9 MB) copied, 16.231 s, 240 kB/s Spoiler:
Both recovered files attached here. |
02-21-2013, 04:59 PM | #30 |
Going Viral
Posts: 17,212
Karma: 18210809
Join Date: Feb 2012
Location: Central Texas
Device: No K1, PW2, KV, KOA
|
K5pw, main-5.3.0
The search continues for dot-config files with a little bit of prep work.
Spoiler:
That trailing one is too big to be a dot-config file on the end of it. Moving right along, try to pull an initramfs (irfs) 'cpio -H newc' archive off of the trimmed image. Spoiler:
The initramFS is attached here, but it seems clear that Amazon started to strip the dot-config file off with the 5.2 firmware series. Next, they might even realize they are making their compiled initramfs code GPL by statically linking it into the kernel image. A provision was added to the kernel back in 2005 for exactly the case of vendors that did not want their initramfs code to catch the GPL virus. Ah, but not even the professionals seem to read the documentation. Last edited by knc1; 02-21-2013 at 05:08 PM. |
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Unbearable Oversight of the [Original] Nook Tablet Devs! | sarahmelissa | Nook Color & Nook Tablet | 9 | 08-28-2012 06:51 PM |
Why don't we just signup as Active Content Devs? | nathansuchy | Kindle Developer's Corner | 4 | 06-16-2012 09:31 PM |
Touch [Question devs] Will we ever get Custom library? | danskmacabre | Kobo Reader | 4 | 04-02-2012 06:29 PM |
Suggestions for Kindle Devs | jxh11215 | Kindle Developer's Corner | 5 | 03-28-2010 07:35 AM |