build: move rootfs processing code to include/rootfs.mk so it can be reused later