Replace tar extract with dd in mkinstall
|Status:||Closed||Start date:||14 Jan 2014|
|Category:||05 - Releases|
|Severity:||02 - High|
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.