Skip to content

Commit a3ef725

Browse files
Pavan-Nokiamssonicbld
authored andcommitted
[Nokia-7215] Fix software upgrade corner case (#20169)
After software upgrade the box fails to boot to the new image due to a bug in uboot of unable to read fragmented files. Make sure all files accessed by Uboot are defragmented before rebooting the device
1 parent 3c52766 commit a3ef725

File tree

1 file changed

+19
-3
lines changed

1 file changed

+19
-3
lines changed

platform/marvell/platform_armhf.conf

+19-3
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,15 @@ demo_mnt=/tmp
6161
FW_ENV_DEFAULT='/dev/mtd0 0x00500000 0x80000 0x100000 8'
6262
UBOOT_FW_DEFAULT=1
6363

64+
defrag_file() {
65+
echo "Defragment file: $1 (used by U-Boot)"
66+
e4defrag $1 >/dev/null
67+
if [ $? -ne 0 ]; then
68+
echo "ERROR: defrag failed for $1"
69+
exit 3
70+
fi
71+
}
72+
6473
prepare_boot_menu() {
6574
echo "Sync up cache ..."
6675
sync
@@ -100,15 +109,22 @@ prepare_boot_menu() {
100109
echo $FW_ENV_DEFAULT > /etc/fw_env.config
101110
echo "Using pre-configured uboot env"
102111
fi
112+
113+
image_name=${image_dir}${kernel_fname}
114+
initrd_name=${image_dir}${initrd_fname}
115+
fdt_name=${image_dir}${fdt_fname}
116+
103117
if [ "$PLATFORM" = "armhf-nokia_ixs7215_52x-r0" ]; then
104118
FW_ENV_DEFAULT='/dev/mtd0 0x00100000 0x10000 0x10000'
105119
echo $FW_ENV_DEFAULT > /etc/fw_env.config
106120
echo "Using pre-configured uboot env for armhf-nokia_ixs7215_52x-r0"
121+
if [ "$install_env" != "onie" ]; then
122+
defrag_file ${demo_mnt}/${image_name}
123+
defrag_file ${demo_mnt}/${initrd_name}
124+
defrag_file ${demo_mnt}/${fdt_name}
125+
fi
107126
fi
108127

109-
image_name=${image_dir}${kernel_fname}
110-
initrd_name=${image_dir}${initrd_fname}
111-
fdt_name=${image_dir}${fdt_fname}
112128

113129
if [ "$install_env" = "onie" ]; then
114130
FW_ARG="-f"

0 commit comments

Comments
 (0)