I have been working on building a Linux based OS for Raspberry-pi using buildroot.I am generating the required empty .img file using dd and fdisk utilities. I am creating two empty partitions as follows; partition1:vfat and partition2:ext4. Further I had to copy the bootloader files to partion1 and the root  filesystem files generated by buildroot to partition2. I used to achieve the above using kpartx utility by mounting the image file and copying the files to the mounted partitions. But drawback of this is that it needs root privilege.I was wondering whether there was any other way to do this without the need for root privilege? Does anybody have any idea about this?references: https://superuser.com/questions/367196/linux-how-to-format-multiple-file-systems-within-one-file?newreg=754bef1f5f6446e18cb816d0edf750fd http://robert.penz.name/73/kpartx-a-tool-for-mounting-partitions-within-an-image-file/
How to write to an .img file with two different partitions?
raspberry pi;dd;fdisk;buildroot