Register Guidelines E-Books Today's Posts Search

Go Back   MobileRead Forums > E-Book Readers > Kobo Reader > Kobo Developer's Corner

Notices

Reply
 
Thread Tools Search this Thread
Old 05-26-2019, 06:09 AM   #1
BloodRagg
Zealot
BloodRagg ought to be getting tired of karma fortunes by now.BloodRagg ought to be getting tired of karma fortunes by now.BloodRagg ought to be getting tired of karma fortunes by now.BloodRagg ought to be getting tired of karma fortunes by now.BloodRagg ought to be getting tired of karma fortunes by now.BloodRagg ought to be getting tired of karma fortunes by now.BloodRagg ought to be getting tired of karma fortunes by now.BloodRagg ought to be getting tired of karma fortunes by now.BloodRagg ought to be getting tired of karma fortunes by now.BloodRagg ought to be getting tired of karma fortunes by now.BloodRagg ought to be getting tired of karma fortunes by now.
 
BloodRagg's Avatar
 
Posts: 128
Karma: 842196
Join Date: Feb 2019
Device: none
Kobo Bootimage Packer/Unpacker

Hi,

These are scripts for packing and unpacking the bootimage of Kobo devices.

I made these a while ago but never had a reason to release them until now
They are tested on a Kobo Aura HD and a couple of images (clara,h2o,hd iirc)

Instead of running through the code. I solely used the image binary for reverse engineering.
The memory maps are done in hexadecimal offset instead of decimal offsets (crazy humans)
Which as you can see makes more sense. I think I found all the checksums and magic markers.

Of course with all reverse engineering don't expect this to be in 100% working order.
But should give you enough room to play

kbunpack.sh: unpacks a bootimage into its parts.
kbpack.sh: packs and or repacks the bootimage.

So you can insert new kernels waveforms dtb's and more.

This is what I know to be true thus far, this isnt 100% fact.

Code:
Flash/Mmc layout found in master boot record with an offset of
9.5MiB to 24MiB.

Sector Size= 512 bytes
Device          Sectors   Size Id Type   Name
------------------------------------------------------------
mmcblk0          19456    9.5M -- RAW    bootimage Aura HD
mmcblk0          49152   24.0M -- RAW    bootimage Aura H2O
------------------------------------------------------------
mmcblk0p1        524289   256M 83 Linux  rootfs
mmcblk0p2        524289   256M 83 Linux  recoveryfs
mmcblk0p3        rest        rest b  FAT32  KOBOeReader
------------------------------------------------------------

The map of the boot image, goes for most devices.
Newer devices have a firmware and device tree blob (mx6)

[ master boot record      ] at 0x00000000
[ serial number           ] at 0x00000200
[ u-boot binary           ] at 0x00000400
[ ntx config size         ] at 0x0007fff0
[ ntx hardware config     ] at 0x00080000
[ firmware blob size      ] at 0x00080bf0
[ firmware blob           ] at 0x00080c00
[ linux device tree blob  ] at 0x000a0c00
[ u-boot environment      ] at 0x000c0000
[ data1 (unknown)         ] at 0x000e0000
[ data2 (unknown)         ] at 0x000f0000
[ uImage/kernel           ] at 0x00100000
[ ramdisk/initrd (unused) ] at 0x00400000
[ e-ink waveform size     ] at 0x006ffff0
[ e-ink waveform          ] at 0x00700000
[ logo (unused)           ] at 0x00900000 (overwritten if waveform is bigger)
[ Aura HD END-------------] at 0x00980000
[ Aura H2O END------------] at 0x01800000

u-boot has been modified by ntx for three purposes:
1. adding the board configuration
2. adding multiple boot configurations, they modified it
   to boot into 3 configurations
   * boot from rootfs into Kobo e-Reader software
     (press power)
   * boot from recoveryfs into recovery software
     (hold light button, then press power)
   * boot from external mmc/sdcard if present on device.
     (hold light button and hold power button)
3. custom boot functions that start with 'ntx_' that
   loads into memory:
   * ntx hardware configuration
   * device tree blob (mx6)
   * e-ink waveform
   then starts the kernel
   
On the root partition /dev/root which is a softlink to either
 * /dev/mmcblk0p1 (rootfs)
 * /dev/mmcblk0p2 (recoveryfs)
 * /dev/mmcblk1p1 (micro sd card)

searches for /linuxrc    (softlink to /bin/busybox)
searches for /sbin/init  (softlink to /bin/busybox)
kicks of /etc/init.d/rcS (in single user mode)
kicks of /etc/inittab    (in multi user mode)

/etc/init.d/rcS
* mounts /proc /sys /dev /var /tmp (basic liunx setup)
* loads udev to populate /dev (i think they chose for udev as mdev hangs on hotplug/kernel panic *kernel bug*)
* drivers are loaded (loading with insmod instead of fixing modprobe and loading it)
* powerled is turned off
* e-Reader software is loaded
Unpacking:
Code:
build@build:~$ ./kbunpack.sh boot.img
Kobo Boot Image Unpacker v0.1b (c) April 2019 GPLv2 by BloodRagg

Extracting Image
  extracting: mbr.img (mbr)
  extracting: serial.img (serial)
  extracting: ubootbin.img (ubootbin)
  extracting: hwconfig.img (hwconfig)
  extracting: fw.img (fw)
  extracting: dtb.img (dtb)
  extracting: ubootenv.img (ubootenv)
  extracting: data1.img (data1)
  extracting: data2.img (data2)
  extracting: uimage.img (uimage)
  extracting: initrd.img (initrd)
  extracting: waveform.img (waveform)
Done.
build@build:~$ ls -l
-rw-rw-r-- 1 build build     2048 mei 26 12:16 data1.bin
-rw-rw-r-- 1 build build    65536 mei 26 12:16 data1.img
-rw-rw-r-- 1 build build     2048 mei 26 12:16 data2.bin
-rw-rw-r-- 1 build build    65536 mei 26 12:16 data2.img
-rw-rw-r-- 1 build build       66 mei 26 12:16 hwconfig.bin
-rw-rw-r-- 1 build build     3072 mei 26 12:16 hwconfig.img
-rw-rw-r-- 1 build build     6144 mei 26 12:16 initrd.bin
-rw-rw-r-- 1 build build  3145712 mei 26 12:16 initrd.img
-rw-rw-r-- 1 build build      512 mei 26 12:16 mbr.img
-rw-rw-r-- 1 build build      456 mei 26 12:16 mbr.txt
-rw-rw-r-- 1 build build      512 mei 26 12:16 serial.img
-rw-rw-r-- 1 build build       17 mei 26 12:16 serial.txt
-rw-rw-r-- 1 build build   145972 mei 26 12:16 ubootbin.bin
-rw-rw-r-- 1 build build   523248 mei 26 12:16 ubootbin.img
-rw-rw-r-- 1 build build   131072 mei 26 12:16 ubootenv.img
-rw-rw-r-- 1 build build      674 mei 26 12:16 ubootenv.txt
-rw-rw-r-- 1 build build  1953688 mei 26 12:16 uimage.bin
-rw-rw-r-- 1 build build  3145728 mei 26 12:16 uimage.img
-rw-rw-r-- 1 build build  6760928 mei 26 12:16 waveform.bin
-rw-rw-r-- 1 build build 17825808 mei 26 12:16 waveform.img
-rw-rw-r-- 1 build build  1953624 mei 26 12:16 zimage.bin
build@build:~$
Packing...
Code:
./kbpack.sh boot.img hwconfig=hwconfig.bin uimage=uimage.bin mbr=mbr.img waveform=waveform.bin

Kobo Boot Image Packer v0.1b (c) April 2019 GPLv2 by BloodRagg

Building Image
  adding: hwconfig.bin (hwconfig)
  adding: uimage.bin (uimage)
  adding: mbr.img (mbr)
  adding: waveform.bin (waveform)
Done.

Imagefile: boot.img
build@build:~$

Enjoy,
BloodRagg

Disclaimer:
This shell script is provided as is without any guarantees or warranty. In
association with the product, I make no warranties or responsibility of any
kind, either express or implied, including but not limited to warranties of
merchantability, fitness for a particular purpose, of title, or of
noninfringement of third party rights. Use of the product by a user is at
the user’s risk.
Attached Files
File Type: zip kbtools_v0.1b.zip (3.1 KB, 197 views)
File Type: zip kbtools_v0.1c.zip (3.3 KB, 238 views)

Last edited by BloodRagg; 05-31-2019 at 09:35 AM. Reason: Updated to new version v1.0c
BloodRagg is offline   Reply With Quote
Old 05-27-2019, 06:04 AM   #2
BloodRagg
Zealot
BloodRagg ought to be getting tired of karma fortunes by now.BloodRagg ought to be getting tired of karma fortunes by now.BloodRagg ought to be getting tired of karma fortunes by now.BloodRagg ought to be getting tired of karma fortunes by now.BloodRagg ought to be getting tired of karma fortunes by now.BloodRagg ought to be getting tired of karma fortunes by now.BloodRagg ought to be getting tired of karma fortunes by now.BloodRagg ought to be getting tired of karma fortunes by now.BloodRagg ought to be getting tired of karma fortunes by now.BloodRagg ought to be getting tired of karma fortunes by now.BloodRagg ought to be getting tired of karma fortunes by now.
 
BloodRagg's Avatar
 
Posts: 128
Karma: 842196
Join Date: Feb 2019
Device: none
No comments at all, is my programming that bad ?

You can use this on full sd card >> images << too, I forgot to mention that.

Last edited by BloodRagg; 05-27-2019 at 09:44 AM.
BloodRagg is offline   Reply With Quote
Advert
Old 05-27-2019, 09:08 AM   #3
Owl_
Enthusiastic reader
Owl_ ought to be getting tired of karma fortunes by now.Owl_ ought to be getting tired of karma fortunes by now.Owl_ ought to be getting tired of karma fortunes by now.Owl_ ought to be getting tired of karma fortunes by now.Owl_ ought to be getting tired of karma fortunes by now.Owl_ ought to be getting tired of karma fortunes by now.Owl_ ought to be getting tired of karma fortunes by now.Owl_ ought to be getting tired of karma fortunes by now.Owl_ ought to be getting tired of karma fortunes by now.Owl_ ought to be getting tired of karma fortunes by now.Owl_ ought to be getting tired of karma fortunes by now.
 
Posts: 424
Karma: 3880485
Join Date: Mar 2017
Location: Italy
Device: Kindle paperwhite3, Kobo aura one, kobo touch 2.0, Kobo Clara HD,Poke2
Quote:
Originally Posted by BloodRagg View Post
No comments at all, is my programming that bad ?

You can use this on sd card images too, I forgot to mention that.
Do you mean I can create an image of my Kobo Aura One (It has an welded chip, not an internal micro sd)?
Owl_ is offline   Reply With Quote
Old 05-27-2019, 09:42 AM   #4
BloodRagg
Zealot
BloodRagg ought to be getting tired of karma fortunes by now.BloodRagg ought to be getting tired of karma fortunes by now.BloodRagg ought to be getting tired of karma fortunes by now.BloodRagg ought to be getting tired of karma fortunes by now.BloodRagg ought to be getting tired of karma fortunes by now.BloodRagg ought to be getting tired of karma fortunes by now.BloodRagg ought to be getting tired of karma fortunes by now.BloodRagg ought to be getting tired of karma fortunes by now.BloodRagg ought to be getting tired of karma fortunes by now.BloodRagg ought to be getting tired of karma fortunes by now.BloodRagg ought to be getting tired of karma fortunes by now.
 
BloodRagg's Avatar
 
Posts: 128
Karma: 842196
Join Date: Feb 2019
Device: none
Quote:
Originally Posted by Owl_ View Post
Do you mean I can create an image of my Kobo Aura One (It has an welded chip, not an internal micro sd)?
>>BRICK WARNING<<

No, I made an Image Dumper for that (click here)

Then you can copy the image to your PC and play around with these tools.

Unless you really know what you are doing you should not attempt to write modified
images back to your device. That's for people with internal sd cards only! Because
they can replace it if anything goes wrong.
BloodRagg is offline   Reply With Quote
Old 05-29-2019, 11:04 AM   #5
jgneff
Member
jgneff brings flavor and color to the partyjgneff brings flavor and color to the partyjgneff brings flavor and color to the partyjgneff brings flavor and color to the partyjgneff brings flavor and color to the partyjgneff brings flavor and color to the partyjgneff brings flavor and color to the partyjgneff brings flavor and color to the partyjgneff brings flavor and color to the partyjgneff brings flavor and color to the partyjgneff brings flavor and color to the party
 
jgneff's Avatar
 
Posts: 21
Karma: 147742
Join Date: Nov 2017
Location: Vancouver, BC, Canada
Device: Kobo Touch B/C, Kobo Glo HD, Kobo Clara HD, Kobo Libra 2
Quote:
Originally Posted by BloodRagg View Post
2. adding multiple boot configurations, they modified it to boot into 3 configurations
* boot from rootfs into Kobo e-Reader software (press power)
* boot from recoveryfs into recovery software (hold light button, then press power)
* boot from external mmc/sdcard if present on device. (hold light button and hold power button)
Thanks for all the interesting information. Do you know what "hold light button" means? Is that the reset button that you can press through the hole in the back with a paper clip?
jgneff is offline   Reply With Quote
Advert
Old 05-29-2019, 06:27 PM   #6
sherman
Guru
sherman ought to be getting tired of karma fortunes by now.sherman ought to be getting tired of karma fortunes by now.sherman ought to be getting tired of karma fortunes by now.sherman ought to be getting tired of karma fortunes by now.sherman ought to be getting tired of karma fortunes by now.sherman ought to be getting tired of karma fortunes by now.sherman ought to be getting tired of karma fortunes by now.sherman ought to be getting tired of karma fortunes by now.sherman ought to be getting tired of karma fortunes by now.sherman ought to be getting tired of karma fortunes by now.sherman ought to be getting tired of karma fortunes by now.
 
Posts: 875
Karma: 2676800
Join Date: Aug 2008
Location: Taranaki - NZ
Device: Kobo Aura H2O, Kobo Forma
Quote:
Originally Posted by jgneff View Post
Thanks for all the interesting information. Do you know what "hold light button" means? Is that the reset button that you can press through the hole in the back with a paper clip?
Some early lighted models (for example, the Glo) had a dedicated button to toggle the frontlight on/off. That's probably the button referred to.
sherman is offline   Reply With Quote
Old 05-30-2019, 03:56 PM   #7
BloodRagg
Zealot
BloodRagg ought to be getting tired of karma fortunes by now.BloodRagg ought to be getting tired of karma fortunes by now.BloodRagg ought to be getting tired of karma fortunes by now.BloodRagg ought to be getting tired of karma fortunes by now.BloodRagg ought to be getting tired of karma fortunes by now.BloodRagg ought to be getting tired of karma fortunes by now.BloodRagg ought to be getting tired of karma fortunes by now.BloodRagg ought to be getting tired of karma fortunes by now.BloodRagg ought to be getting tired of karma fortunes by now.BloodRagg ought to be getting tired of karma fortunes by now.BloodRagg ought to be getting tired of karma fortunes by now.
 
BloodRagg's Avatar
 
Posts: 128
Karma: 842196
Join Date: Feb 2019
Device: none
Quote:
Originally Posted by jgneff View Post
Thanks for all the interesting information. Do you know what "hold light button" means? Is that the reset button that you can press through the hole in the back with a paper clip?
No, what sherman said. Mine indeed has a light button. That said it can be one of the other buttons if you have any. Just look at the factory reset sequence for you device.

Quote:
Originally Posted by sherman View Post
Some early lighted models (for example, the Glo) had a dedicated button to toggle the frontlight on/off. That's probably the button referred to.
Correct
BloodRagg is offline   Reply With Quote
Old 05-31-2019, 05:20 AM   #8
frostschutz
Linux User
frostschutz ought to be getting tired of karma fortunes by now.frostschutz ought to be getting tired of karma fortunes by now.frostschutz ought to be getting tired of karma fortunes by now.frostschutz ought to be getting tired of karma fortunes by now.frostschutz ought to be getting tired of karma fortunes by now.frostschutz ought to be getting tired of karma fortunes by now.frostschutz ought to be getting tired of karma fortunes by now.frostschutz ought to be getting tired of karma fortunes by now.frostschutz ought to be getting tired of karma fortunes by now.frostschutz ought to be getting tired of karma fortunes by now.frostschutz ought to be getting tired of karma fortunes by now.
 
frostschutz's Avatar
 
Posts: 2,282
Karma: 6123806
Join Date: Sep 2010
Location: Heidelberg, Germany
Device: none
for the (original) H2O which does not have a light button, you trigger the boot mode with the touchscreen instead... tap both bottom screen corners while holding the power button -> factory reset. don't try it unless you want to lose your data.
frostschutz is offline   Reply With Quote
Old 05-31-2019, 05:44 AM   #9
BloodRagg
Zealot
BloodRagg ought to be getting tired of karma fortunes by now.BloodRagg ought to be getting tired of karma fortunes by now.BloodRagg ought to be getting tired of karma fortunes by now.BloodRagg ought to be getting tired of karma fortunes by now.BloodRagg ought to be getting tired of karma fortunes by now.BloodRagg ought to be getting tired of karma fortunes by now.BloodRagg ought to be getting tired of karma fortunes by now.BloodRagg ought to be getting tired of karma fortunes by now.BloodRagg ought to be getting tired of karma fortunes by now.BloodRagg ought to be getting tired of karma fortunes by now.BloodRagg ought to be getting tired of karma fortunes by now.
 
BloodRagg's Avatar
 
Posts: 128
Karma: 842196
Join Date: Feb 2019
Device: none
I've looked into the reset button, it does nothing i.c.w. any other buttons.
Afaict its just what it says. A pinhole button to reset your cpu in case it hangs.
BloodRagg is offline   Reply With Quote
Old 05-31-2019, 09:38 AM   #10
BloodRagg
Zealot
BloodRagg ought to be getting tired of karma fortunes by now.BloodRagg ought to be getting tired of karma fortunes by now.BloodRagg ought to be getting tired of karma fortunes by now.BloodRagg ought to be getting tired of karma fortunes by now.BloodRagg ought to be getting tired of karma fortunes by now.BloodRagg ought to be getting tired of karma fortunes by now.BloodRagg ought to be getting tired of karma fortunes by now.BloodRagg ought to be getting tired of karma fortunes by now.BloodRagg ought to be getting tired of karma fortunes by now.BloodRagg ought to be getting tired of karma fortunes by now.BloodRagg ought to be getting tired of karma fortunes by now.
 
BloodRagg's Avatar
 
Posts: 128
Karma: 842196
Join Date: Feb 2019
Device: none
Released new version , kernel/uImage extraction was 64 bytes too short

Extracting correctly now as sha256sum matched:
Code:
32cead0bc7b1a809d1f0d8f7e5ac0f321ffe0abe7e01e7901cdd82488ddd75e1  uImage-sdcard.bin
32cead0bc7b1a809d1f0d8f7e5ac0f321ffe0abe7e01e7901cdd82488ddd75e1  uImage-E606C0 (update 4.15 mark4)

Last edited by BloodRagg; 05-31-2019 at 09:45 AM. Reason: Typo
BloodRagg is offline   Reply With Quote
Reply


Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
PRS-T2 Firmware Unpacker ebmr Sony Reader Dev Corner 9 11-02-2012 07:46 AM
Free (nook/Kindle) The Evil Friendship by Vin Packer [Vintage Lesbian Crime Thriller] ATDrake Deals and Resources (No Self-Promotion or Affiliate Links) 5 06-25-2012 09:28 AM
Free (nook/Kindle) The Twisted Ones by Vin Packer [Vintage Pulp Crime Thriller] ATDrake Deals and Resources (No Self-Promotion or Affiliate Links) 19 05-20-2012 10:24 PM
Hello Martin Packer here Martin Packer Introduce Yourself 4 01-28-2012 04:52 AM


All times are GMT -4. The time now is 07:15 AM.


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