Originally Posted by drogon
when I do:
dd if=/dev/zero of=/dev/mmcblk0p3 bs=4K
dd:writing '/dev/mmcblk0p3':No space left on device
How should I deal with it?
And how to use fastboot to flash kernel-5.0.4.img?
It should have wiped the entire partition before the error message. If you do not want the error message, the quick and dirty way is to add 2>/dev/null to the end of the command.
The "right" way is more complicated (which I try to avoid whenever possible), and requires that you find out how many blocks your destination has. There are a number of ways to do that. Using "fdisk -l" is one of them (but those are 512-byte blocks, so you have to divide by 8 to get 4K blocks), or you can use "df" (but that gives 1K blocks so you need to divide by 4). Then you need to add the computed block count to the "count=" parameter of "dd".
As you can see, it is a lot more complicated than my one-line answer, which just ignores the "normal" error when the device gets full.
Another way would be just to write enough to "kill" the partition format, such as "count=1000" or something...
The point is to make the partition no longer mountable, so that the startup scripts will reformat that partition during the next reboot.