diff options
Diffstat (limited to 'meta-phosphor/recipes-phosphor/initrdscripts')
-rw-r--r-- | meta-phosphor/recipes-phosphor/initrdscripts/phosphor-mmc-init/mmc-init.sh | 16 |
1 files changed, 14 insertions, 2 deletions
diff --git a/meta-phosphor/recipes-phosphor/initrdscripts/phosphor-mmc-init/mmc-init.sh b/meta-phosphor/recipes-phosphor/initrdscripts/phosphor-mmc-init/mmc-init.sh index ec4b745db..d41ddf713 100644 --- a/meta-phosphor/recipes-phosphor/initrdscripts/phosphor-mmc-init/mmc-init.sh +++ b/meta-phosphor/recipes-phosphor/initrdscripts/phosphor-mmc-init/mmc-init.sh @@ -17,11 +17,23 @@ mount sys sys -tsysfs mount proc proc -tproc mount tmpfs run -t tmpfs -o mode=755,nodev +# Wait up to 5s for the mmc device to appear. Continue even if the count is +# exceeded. A failure will be caught later like in the mount command. +mmcdev="/dev/mmcblk0" +count=0 +while [ $count -lt 5 ]; do + if [ -e "${mmcdev}" ]; then + break + fi + sleep 1 + count=$((count + 1)) +done + # Move the secondary GPT to the end of the device if needed. Look for the GPT # header signature "EFI PART" located 512 bytes from the end of the device. -magic=$(tail -c 512 /dev/mmcblk0 | hexdump -C -n 8 | grep "EFI PART") +magic=$(tail -c 512 "${mmcdev}" | hexdump -C -n 8 | grep "EFI PART") if test -z "${magic}"; then - sgdisk -e /dev/mmcblk0 + sgdisk -e "${mmcdev}" partprobe fi |