Lastly, if you want this to be part of the build itself, you can
probably automate mounting your file system onto your build machine
and doing the modes that way. The actual method depends on whether
your system image is yaffs, ext4, etc. For yaffs, you can get unyaffs
for unpacking it, and then repack it with mkyaffs2image. For ext4,
you can just mount it directly in Linux and modify it.
These are all just hacks though. There must be a better way.