When calling mk_mmc.sh with a --device flag where the device name matches the beginning of several devices, the variable FDISK will be assigned several rows of matches:
Ex.
Calling mk_mmc.sh with --device /dev/mmcblk0 on a system where the device tree looks like this:
/dev/mmcblk0
/dev/mmcblk0boot1
/dev/mmcblk0boot2
will assign FDISK with all those matches. Hence the comparison on line 1273 will fail
even though the device exist.
Example output from the program:
./mk_mmc.sh --mmc /dev/mmcblk0 --dtb am335x-boneblack --distro wheezy-armhf --firmware
Are you sure? I Don't see [/dev/mmcblk0], here is what I do see...
fdisk -l:
Disk /dev/mmcblk0: 1920 MB, 1920991232 bytes, 3751936 sectors
Disk /dev/mmcblk0boot1: 1 MB, 1048576 bytes, 2048 sectors
Disk /dev/mmcblk0boot0: 1 MB, 1048576 bytes, 2048 sectors
My solution is simple but will clearly fail if the other matches contains anything else than a-z,A-Z,0-9 after the similar characters in their names. Maybe a better regexp would be appropriate.
Thanks Marcus. This patch looks fine. I'd like to completely drop the fdisk usage and just use lsblk instead as that should now be available in most 'non-eol' linux systems.
Regards,
When calling mk_mmc.sh with a --device flag where the device name matches the beginning of several devices, the variable FDISK will be assigned several rows of matches:
Ex. Calling mk_mmc.sh with --device /dev/mmcblk0 on a system where the device tree looks like this:
will assign FDISK with all those matches. Hence the comparison on line 1273 will fail even though the device exist.
Example output from the program:
My solution is simple but will clearly fail if the other matches contains anything else than a-z,A-Z,0-9 after the similar characters in their names. Maybe a better regexp would be appropriate.