| |
@@ -0,0 +1,38 @@
|
| |
+ #!/bin/bash
|
| |
+
|
| |
+ cleanup()
|
| |
+ {
|
| |
+ rm -rf /tmp/fw_bk &> /dev/null
|
| |
+ return
|
| |
+ }
|
| |
+
|
| |
+ echo "= Reformat the ESP filesystem to use the device geometry"
|
| |
+ if [ "$FIRMPART" == "" ] ; then
|
| |
+ echo "ERROR: Firmware partition not available - wrong image?"
|
| |
+ return
|
| |
+ fi
|
| |
+
|
| |
+ mkdir /tmp/fw_bk
|
| |
+ cp -a /tmp/fw/* /tmp/fw_bk/
|
| |
+ umount /tmp/fw
|
| |
+
|
| |
+ UUID="$(lsblk -no UUID $FIRMPART)"
|
| |
+ mkfs.vfat "$FIRMPART" &> /dev/null
|
| |
+ if [ $? != 0 ] ; then
|
| |
+ echo "ERROR: Firmware partition filesystem reformatting failed!"
|
| |
+ cleanup
|
| |
+ fi
|
| |
+
|
| |
+ # restore the old filesystem UUID to match the /etc/fstab
|
| |
+ printf "\x${UUID:7:2}\x${UUID:5:2}\x${UUID:2:2}\x${UUID:0:2}" \
|
| |
+ | dd bs=1 seek=67 count=4 conv=notrunc of="$FIRMPART" status=none
|
| |
+
|
| |
+ # restore the firmware files from the backup directory
|
| |
+ mount "$FIRMPART" /tmp/fw
|
| |
+ cp -a /tmp/fw_bk/* /tmp/fw/
|
| |
+
|
| |
+ sync
|
| |
+ cleanup
|
| |
+
|
| |
+ # set console
|
| |
+ SYSCON=ttyS2,115200
|
| |
The bootROM for some SoCs (e.g: AM625 used in the BeaglePlay board) aren't
able to boot when the ESP partition vfat filesystem geometry doesn't match
the expected sectors/track and head numbers.
Because the Fedora images are generated using a loopback device, they have
a 63 sectors/track, 16 heads geometry but for SD block devices this should
be 32 sectors/track, 64 heads for the AM625 SoC bootROM to boot the board.
To make sure that the ESP vfat filesystem will have the correct geometry,
reformat the partition when flashing the Fedora image to the block device.
Some SoCs support loading the firmware binaries from block device sectors,
and so the files can be stored as raw data in the gap between the MBR and
the first partition. But this option is not available in the BeaglePlay
bootROM. For this reason, the only possible option is to store in the ESP.
Suggested-by: Erico Nunes nunes.erico@gmail.com
Signed-off-by: Javier Martinez Canillas javierm@redhat.com