It would probably be a better solution to introduce an Octeon-like BOOT kernel on loongson and use it as the bootloader on all loongson platforms, if only because of the dire bugs in their ext2fs implementation.
Doing this would make the Gdium-specific boot shenanigans much, much simpler.
