Draft: Introduce copy_file helper program to replace copy_file function
The copy_file
function is executed to copy most files other than
kernel modules and firmware, and it executes several external commands
for each of those files. This can be quite slow.
Move all that logic into a helper program written in C. Currently
this still uses the "cp
" command at the end, because copying files
efficiently is relatively complex, but the rest is done in-process.