I have built a home-grown Linux distribution, and I can make the complete disk image file as a non-root user with one exception -- installing the boot loader. I'm using syslinux (actually extlinux), and to install it I have to loop-back mount the boot partition, which requires root/sudo privileges. The commands are run from a makefile, and the variable names should clearly indicate what to replace them with.
sudo losetup -o $(BOOT_FS_PARTITION_OFFSET) $(LOOP_DEVICE) $(IMAGE_FILE_NAME) sudo mount $(LOOP_DEVICE) $(LOOP_MOUNT_POINT) sudo $(EXTLINUX) -S $(DISK_SECTORS) -H $(DISK_HEADS) -i $(LOOP_MOUNT_POINT) sudo umount $(LOOP_MOUNT_POINT) sudo losetup -d $(LOOP_DEVICE)
Is there a way to write syslinux or extlinux to the disk image file without requiring root privileges?