@JSWolf: I can't tell you which tools you need to do this on Windows, but here comes a (hopefully complete) howto for Linux.
Disclaimer
While the procedure below does not make any modifications to the contents of the internal storage of the
Kobo Aura H2O many of the commands below require
root privileges on your computer. It is assumed you are aware of the risks when writing to devices and filesystems with
root privileges. I do not take any responsibility for damage or loss of data by doing so.
Prerequisites
- Working usbnet on the kobo
By default, the kobo has the address 192.168.2.101. In the following it is assumed that the connected PC has the IP address 192.168.2.102.
- Linux (or similar) system with root privileges on your computer
Make backup copy of internal SD
- Telnet into the kobo and log in as root. The default password is empty.
- Remount the root filesystem read-only and unmount the data partition.
kobo:
Code:
umount /mnt/onboard
mount -o remount,ro /
- Prepare to receive the internal SD card image using netcat.
pc:
Code:
nc -l -p 12345 > mmcblk0.img.gz
- Dump the internal SD card via netcat using gzip compression.
kobo:
Code:
dd if=/dev/mmcblk0 | gzip -c | nc 192.168.2.102 12345
- Wait for the process to finish. This will take a while. I did not check if it is faster to perform the compression on the kobo to reduce the amount of transferred data or not.
- Remount the filesystems.
kobo:
Code:
mount -o remount,rw /
mount -t vfat -o noatime,nodiratime,shortname=mixed,utf8 /dev/mmcblk0p3 /mnt/onboard
Contents of the image
From the image above we may extract the single partitions. But we will not need to do so.
Let's have a look at the partition table:
Code:
gzip -dc mmcblk0.img.gz | dd bs=512 count=1 of=mmcblk0.bs
fdisk -l mmcblk0.bs
result:
Code:
Disk mmcblk0.bs: 512 B, 512 bytes, 1 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: dos
Disk identifier: 0x00000000
Device Boot Start End Sectors Size Id Type
mmcblk0.bs1 49152 573440 524289 256M 83 Linux
mmcblk0.bs2 573441 1097729 524289 256M 83 Linux
mmcblk0.bs3 1097730 7744511 6646782 3.2G b W95 FAT32
The sectors < 49152 contain the
u-boot boot loader, the hardware configuration data, the Linux kernel, and other firmware data.
Write the image to an SD card
The size of the SD card must be 4 GiB or larger.
Write the image onto the SD card:
Code:
gzip -dc mmcblk0.img.gz | dd of=/dev/sdX
Replace
/dev/sdX with the actual device node for your SD card.
Check the new partitioning of your SD card:
result:
Code:
Disk /dev/sdg: 14.9 GiB, 15931539456 bytes, 31116288 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: dos
Disk identifier: 0x00000000
Device Boot Start End Sectors Size Id Type
/dev/sdg1 49152 573440 524289 256M 83 Linux
/dev/sdg2 573441 1097729 524289 256M 83 Linux
/dev/sdg3 1097730 7744511 6646782 3.2G b W95 FAT32
To avoid running into the recovery function perform a filesystem check of the user data partition:
Fix any errors found. In my case differing boot sector copies were found and I had the backup copy rewritten using the original boot sector.
Modify hardware configuration data
Extract the hardware configuration data:
Code:
gzip -dc mmcblk0.img.gz | dd bs=512 skip=1024 count=1 of=mmcblk0.hwconfig
Using a hex editor change the byte at offset
0x3F from
0 to
1 to enable booting from the external SD card.
Write the modified hardware configuration back to the SD card:
Code:
dd if=mmcblk0.hwconfig bs=512 seek=1024 of=/dev/sdX
Adjust the system to work from the external SD card
The image contains commands mounting partitions from the internal SD card
mmcblk0. In order to obtain a truly independent system a few changes are necessary.
Mount the root filesystem of the SD card:
Code:
mount /dev/sdX1 /mnt
Add device nodes for
mmcblk1* and remove
/mnt/etc/udev.tgz:
Code:
mknod /mnt/dev/mmcblk1 b 179 8
mknod /mnt/dev/mmcblk1p1 b 179 9
mknod /mnt/dev/mmcblk1p2 b 179 10
mknod /mnt/dev/mmcblk1p3 b 179 11
rm /mnt/etc/udev.tgz
The file
udev.tgz will be recreated at boot time and then contain the necessary device nodes as well.
Edit
/mnt/etc/init.d/rcS and replace references to
mmcblk0p1 and
mmcblk0p3 with
mmcblk1p1 and
mmcblk1p3 respectively. This is the corresponding
diff:
Code:
--- a/rcS 2015-08-03 10:53:08.000000000 +0200
+++ b/rcS 2016-11-23 19:43:30.000000000 +0100
@@ -12,7 +12,7 @@
[ $PRODUCT != trilogy ] && PREFIX=$PRODUCT-
-mount -o remount,noatime,nodiratime /dev/mmcblk0p1 /
+mount -o remount,noatime,nodiratime /dev/mmcblk1p1 /
PLATFORM=freescale
if [ `dd if=/dev/mmcblk0 bs=512 skip=1024 count=1 | grep -c "HW CONFIG"` == 1 ]; then
@@ -79,7 +79,7 @@
if [ $(strings /usr/local/Kobo/pickel | grep -c wait-for-hit) -ge 1 ]; then
FS_CORRUPT=0
- dosfsck -a -w /dev/mmcblk0p3 || dosfsck -a -w /dev/mmcblk0p3 || dosfsck -a -w /dev/mmcblk0p3 || dosfsck -a -w /dev/mmcblk0p3 || FS_CORRUPT=1
+ dosfsck -a -w /dev/mmcblk1p3 || dosfsck -a -w /dev/mmcblk1p3 || dosfsck -a -w /dev/mmcblk1p3 || dosfsck -a -w /dev/mmcblk1p3 || FS_CORRUPT=1
if [ $FS_CORRUPT == 1 ]; then
case $PRODUCT in
kraken|phoenix)
@@ -99,9 +99,9 @@
reboot
fi
else
- dosfsck -a -w /dev/mmcblk0p3
+ dosfsck -a -w /dev/mmcblk1p3
fi
-mount -t vfat -o noatime,nodiratime,shortname=mixed,utf8 /dev/mmcblk0p3 /mnt/onboard
+mount -t vfat -o noatime,nodiratime,shortname=mixed,utf8 /dev/mmcblk1p3 /mnt/onboard
rm -rf /mnt/onboard/fsck*
rm -rf /mnt/onboard/FSCK*
rm -rf /usr/local/Kobo/db.tgz
To have a visual confirmation for booting from the SD card one can make the startup animation run backwards by modifying
/mnt/etc/init.d/on-animator.sh. Here's the
diff:
Code:
--- a/on-animator.sh 2012-09-07 22:45:42.000000000 +0200
+++ b/on-animator.sh 2016-11-23 18:50:34.000000000 +0100
@@ -6,6 +6,7 @@
i=0;
while true; do
i=$((((i + 1)) % 11));
- zcat /etc/images/$PREFIX\on-$i.raw.gz | /usr/local/Kobo/pickel showpic 1;
+ j=$((10 - i))
+ zcat /etc/images/$PREFIX\on-$j.raw.gz | /usr/local/Kobo/pickel showpic 1;
usleep 250000;
done
Unmount the SD card:
Start the system from the SD card
- Power off your kobo
- Plug the SD card into your kobo
- Press and hold the power button until the LED is blinking
- If your system boots into Nickel you should see the backwards animation of the 4 squares. I am not aware of another way to tell if Nickel is running from the SD card.
In any case Nickel will complain about the SD card format not being supported.
- If your system boots into Kobo Start Menu you can enable usbnet and telnet into the device or start kbTerminal to run some checks:
command:
result:
Code:
rootfs on / type rootfs (rw)
/dev/root on / type ext4 (rw,noatime,nodiratime,barrier=1,data=ordered)
none on /proc type proc (rw,relatime)
none on /tmp type tmpfs (rw,relatime,size=16384k)
none on /dev type tmpfs (rw,relatime)
none on /var/lib type tmpfs (rw,relatime,size=16k)
none on /var/log type tmpfs (rw,relatime,size=16k)
none on /var/run type tmpfs (rw,relatime,size=128k)
none on /sys type sysfs (rw,relatime)
/dev/mmcblk1p3 on /mnt/onboard type vfat (rw,noatime,nodiratime,fmask=0022,dmask=0022,codepage=cp437,iocharset=iso8859-1,shortname=mixed,utf8,errors=remount-ro)
devpts on /dev/pts type devpts (rw,relatime,mode=600)
command:
result:
Code:
console=ttymxc0,115200 rootwait rw quiet lpj=4997120 root=/dev/mmcblk1p1 rootfstype=ext4 hwcfg_p=0x8ffffe00 hwcfg_sz=110 waveform_p=0x8f98b800 waveform_sz=6768096 mem=505M boot_port=2 mx50_1GHz
command:
Code:
ntx_hwconfig -s -p /dev/mmcblk1 BootOpt
result:
Code:
NtxHwCfg_GetCfgFldStrVal:[WARNING]Config version too old !! Please update config file !!
ESD:ON
The warning message of
ntx_hwconfig is not specific to the external SD card. On my system I get the same warning for the internal hardware configuration data on
mmcblk0.
Outlook
It is not the most comfortable but probably the least invasive method to implement a kind of dual booting. The
u-boot boot loader is still run from the internal SD card and also gets its boot environment from there. I do not know yet from where the kernel is loaded in this setup. Nevertheless I expect this method to provide a way to boot some other Linux system from the external SD card, albeit using kobo's kernel.
I hope this triggers some happy hacking and am curious about any results...
Best regards
Stefan