Replace tar extract with dd in mkinstall
mkinstall mounts the rootfs dir and copies to it in an attempt to make the entire 2nd partition available after installation to the SD card. However, this often fails when trying to set the root user on all those files, possibly because the chown is running while data is still being pushed to the SD card.
To get around this I can create the ext3 image for the rootfs in buildroot.mk (the target is already there) and copy it to the pkg directory with buildroot-pkg. Then the mkinstall can be updated to remove the tar extraction line for the rootfs and replace it with these lines (before the partition is mounted):
sudo dd if=rootfs.ext3 of=$ROOTFSDIR bs=16384 sudo e2label $ROOTFSDIR rootfs sudo e2fsck -f $ROOTFSDIR sudo resize2fs $ROOTFSDIR
where the rootfs.ext3 filename should be made a variable like $RAMDISK (which currently points to the rootfs.tar file).
This will use dd to write to the disk first, then set the proper label, clean up the filesystem and then resize the filesystem to match the partition size. After that the partition can be mounted the the chown run.
Updated by Hammel about 10 years ago
- Status changed from New to Closed
- % Done changed from 50 to 100
Tested with packaging. Works much better. I have had no lockups yet using this method, while with tar to the SD card was slower and often locked up requiring a host reboot.