Have a look at how libguestfs does it:
> Yes, I don't have udev running. Adding udev to the package list for building
> the appliance seems not to be enough, as there's apparently nothing starting
> it. What's the proper way to start udev in this situation?
The rest of the code in the appliance/ subdirectory is useful
to look at too.