-1

I have an embedded device with an emmc and a qspi-flash, both of which have an operating system on them.

From the OS running in the qspi-flash, I have a rootFS.ext4 file, the entire root filesystem for the OS on the emmc. From the qspi, I can see /dev/mmcblk1p3, which is the rootfs partition of the emmc.

I am trying to do dd if=root.ext4 of=/dev/mmcblk1p3 bs=1M Unfortunately when i then boot from the emmc, the kernel is complaining that it cannot mount to mmcblk1p3.

What is the correct way to completely erase the contents of the original filesystem and overlay the new filesystem image into the partition? Am I missing a step?

The mmc partitions are gpt.

alexv9
  • 126
  • 1
  • 9
  • 2
    "*I have a rootFS.ext4 file, the entire root filesystem for the OS*" -- Your **dd** copy should work if the file is a byte-for-byte image of that eMMC partition with a valid filesystem. Apparently it's not (although we only have your interpretation of events). You need to identify the contents of that file. What does the **file** command on that file report? Does the file size match the partition size? If it's really an image of a valid (ext4) filesystem, then you should be able mount the image file (instead of a device node) without having to copy it somewhere. – sawdust Jul 20 '22 at 07:01
  • Thanks for your reply. The problem was two fold: 1. The rootfs image was incorrect 2. I needed to use mkfs.ext4 on the exisitng filesystem to wipe it, i guess, I think that's what happened. Now with the proper image and making sure the filesystem is wiped, the dd worked and I can boot back up from the emmc and verify that new rootfs was copied. – alexv9 Jul 21 '22 at 16:28
  • Since you haven't provided any details nor described how you determined that "*the rootfs file I was using was incorrect*", this topic is likely to be of minimal value to other readers. It's also off-topic for this site. – sawdust Jul 21 '22 at 22:10
  • It was for the wrong system – alexv9 Jul 22 '22 at 21:01

1 Answers1

-1

The rootfs file I was using was incorrect. I also needed to clear the exisiting filesystem by using mkfs.ext4.

Now the dd worked and the new rootfs was copied. I was able to successfully boot up from the emmc and see the new version of the rootfs.

alexv9
  • 126
  • 1
  • 9
  • 1
    "*I also needed to clear the exisiting filesystem ...*" -- No you did not. A block-by-block copy using **dd** would overwrite any existing data. Actually the FTL (flash translation layer) of the eMMC would perform the write by unmapping the existing sector, and then write the contents to a newly mapped, *erased* sector. So proper understanding of the SW utility and HW operations would prove that the previous contents are irrelevant. – sawdust Jul 21 '22 at 22:03