Migration to u-boot
During discussions on IRC about the future boot process using u-boot, we came to the conclusion that we need to repartition the device first. By default, the AC100 using a proprietary partitioning scheme which cannot (or shouldn't?) be supported by mainline kernels. So before introducing a new bootloader, we need to install a new partition table (preferable gpt format) without (also preferable) loosing any data. Older kernels (pre 3.1) will not be able to detect this anymore, so all Android versions with old kernel will fail here. They would fail anyway, because of u-boot, so this is no loss.
A few words to the EMMC (internal storage) layout. There are two different EMMCs build into the various AC100 models. One from SanDisk and one from Toshiba. I mention this because they use different size of secure partitions. These partitions cannot be access by uboot at the time of writing this (may be possible in the future though). On the other hand, the kernel can do. Because we plan to put our bootloader into these partitions, we need to boot a kernel with an initramfs filesystem first to be able to flash the bootloader. Some program needs to detect the EMMC type and flash the bootloader to the “right” place. This “flashing” process is also decribed on this page.
The partition table is then put right a the first sector of the first “normal” partition, so the kernel can find it easily.
What we need?
So we have a plan - what else is needed? First, some script which can create a large image containing everything we need to flash a bootloader and install a new partition table. I wrote a small script just to do this which can be found here. It create a large image containing uboot, kernel, initrd, device tree, and u-boot script which is executed on load. This large image is loaded by tegrarcm without use of nvflash or something like that.
Next step is write some script which runs from the initrd. It needs to:
- find the partitions and create a new efi partition table
- detect the place where to put the bootloader and flash it
- flash the new partiton table
- flash (or copy to /boot) the new kernel
Additionally, the ramdisk could contain a minimal system with network (wifi/usb ethernet/usb gadget) support to present a bootloader menu (e.g. petitboot), to either boot some kernels from some attached storage or via tftp, scp, or similar - all via kexec method.