Refactor and support rootfs booting