Originally Posted by lardman
Ah, what I've said above isn't so important, it's what the on-device setup does that's important. /me goes back to sleep
Right. I did a fresh install of Ubuntu now. It's boring to watch the screen as Ubuntu is installed - no fancy animated presentation of the blessings of this new OS, like we usually get at a time like this.
But after maybe 10 minutes, right at the end of the install, I noticed it wrote something about flashing initrd to mmcblk0p2. When I was back in Android I checked /dev/block/platform/.../by-name/ and saw mmcblk0p2 is marked LNX, so at the end of the install Ubuntu flashes a new boot image! It doesn't seem to work, since I get bootloops when trying to boot normally afterwards, but still I'd like to find where in the Ubuntu install process this is done.
The installation boot image (which I flash to recovery instead) starts up Ubuntu just fine, so there's no need for flashing a new boot at that time, but maybe the new boot is better or I may break Android if updating the Ubuntu kernel?
---------- Post added at 02:22 AM ---------- Previous post was at 01:48 AM ----------
Here's a less complicated procedure for getting dual boot Android/Ubuntu. This will erase your data, void your warranty etc. It might even blow up your device and curdle the milk in your fridge. It worked OK for me, but now you've been warned!
Start with updating to 4.2.1 and unlocking. 4.2.1 isn't essential, but it should be something for which you have the boot image.
Download the Ubuntu boot and root files using the Ubuntu installer, but don't let it install.
fastboot erase recovery
fastboot erase userdata
fastboot flash recovery ~/Downloads/UbuntuNexus7/boot.img
fastboot flash userdata ~/Downloads/UbuntuNexus7/rootfs.img
Start recovery. Ubuntu will now install.
(The Ubuntu install flashes the boot partition at this point, making it unable to boot Android.)
Reboot to bootloader.
Flash the original boot image (mine was 4.2.1) to boot using fastboot.
fastboot flash boot nakasi-jop40d/boot.img
As before, normal boot will start Android, recovery boot will start Ubuntu.
If the Ubuntu install should want to update its initrd at some later time, it will probably flash to boot instead of to recovery.
That has to be looked into.
Edit: I found the culprit. In /usr/share/flash-kernel/functions the last partition with a working boot image is picked for flashing the new boot image. Since recovery is in mmcblk0p1 and boot is in mmcblk0p2 the latter is chosen.
And since the abootimg call only updates the boot image instead of creating a new one, a mix of Android and Ubuntu is created which explains why I got bootloops.
Now I just have to figure out how to modify the script so it picks the right partition. Maybe abootimg can determine if the existing image is Android or Ubuntu? But I'll save that fun for another night
Edit again: This procedure no longer works. I tried installing a new 13.04 Ubuntu but now the installation boot.img won't serve as an ordinary boot. It stops if the initial tarball has already been unpacked. So the script above must be modified and run so mmcblk0p1 is updated with an ordinary boot image.