View Single Post
Old 02-02-2013, 01:35 PM   #51
ah-
Connoisseur
ah- could sell banana peel slippers to a Deveel.ah- could sell banana peel slippers to a Deveel.ah- could sell banana peel slippers to a Deveel.ah- could sell banana peel slippers to a Deveel.ah- could sell banana peel slippers to a Deveel.ah- could sell banana peel slippers to a Deveel.ah- could sell banana peel slippers to a Deveel.ah- could sell banana peel slippers to a Deveel.ah- could sell banana peel slippers to a Deveel.ah- could sell banana peel slippers to a Deveel.ah- could sell banana peel slippers to a Deveel.
 
Posts: 64
Karma: 3062
Join Date: Jan 2012
Device: Kobo Touch
I found a way to hand over to upstart thanks to a nice person in the upstart irc channel, we can just use the Kobo distribution as a kind of initrd, and use pivot_root plus chroot to make the Kindle fs / and start upstart.

Unfortunately I don't have much if any free time after tomorrow, so I'll just post everything I have working up to now.

I got both the 5.1.2 image for the Touch and the 5.3.3 for the Glo somewhat working. The Glo image needed some more tweaks (like manually searching and adding 800x600 images for blanket, plus for the keyboard, and extracting several cramfs images) and doesn't automatically boot into the GUI yet.

Fakeproc.tar.bz2 is a LD_PRELOAD library that can redirect some accesses to /proc/board_id etc. to /fake/proc/board_id if copied to the Kindle fs and put into /etc/ld.so.preload, but it doesn't work with busybox and therefore cat since busybox is statically linked.

The fb_config stuff is used for configuring the framebuffer, run framebuffer_configure once before chrooting to the Kindle fs and fast_update or fast_update_rot to update the screen. I think update_fb is broken, so just ignore that. It depends on the Xorg configuration wether you need the _rot version or not, if you use the wrong one you'll see errors in dmesg.

I modified /etc/init.d/rcS to boot into the Kindle fs when the SD card is inserted during boot or to boot nickel as usual if not. This plus pivot.sh plus the modified Kindle /sbin/init script implements the handover from busybox init to upstart.

The handover kills all running processes, including ssh/telnet. So if you want to connect again, look at the kindle /sbin/init. It might be useful to remove a & at the end of one of the netcat lines to stop the Kobo from rebooting because init died.

There's also a readme.txt i started writing, it's totally incomplete but I don't want this to just sit around and I won't have the time to finish this in the next few weeks.

Be careful about changing mmcblk0 to mmcblk1 everywhere, that's really important. The kindle init scripts like to create new filesystems.

I hope I included everything else I did in the attachment, diff it with against the 5.3.3 initscripts to see what changed.

Random things that might be useful: Use devcap-encrypt to edit /etc/deviceConfig.conf, there's several reboots that have to be uncommented to get it to not reboot after a few seconds, use initctl list/start/stop to talk with upstart, upstart scripts die if there is even one line that doesn't execute successfully (like echo something > /proc/does/not/exist), use tail -f /var/log/messages to get debug output, if the framework doesn't start try executing everything from prereg.conf/firstboot manually in a terminal, use strace on everything that doesn't work as expected, often files/folders are missing and just have to be created with mkdir/touch etc.

What's left to do: Getting it to boot automatically all the way through. Right now it starts only the most basic things, and then requires manual tweaking until it maybe starts X and framework.

Getting things like Wifi to work, maybe writing a wrapper for the eink refresh calls to replace the fb_update scripts, getting the buttons to work and a ton more.

Maybe someone is interested in continuing this, I hope it's at least a bit interesting to look through. With some more work I'm certain that it's possible to get basic reading functionality in a dualboot setup without having to change the Kobo kernel.

Also, I would recommend to start out with an almost empty /etc/upstart and readd things one by one. Really just syslogd, system and dropbear in the beginning and then readd single things while making sure every step works. Else you just get tons of error messages in the logs and have no idea what's going wrong.
Attached Files
File Type: bz2 fakeproc.tar.bz2 (4.3 KB, 61 views)
File Type: bz2 kobostuff.tar.bz2 (304.5 KB, 77 views)

Last edited by ah-; 02-02-2013 at 01:47 PM.
ah- is offline   Reply With Quote