Skip to content

Commit

Permalink
[Nokia-7215] Fix software upgrade corner case (#20169)
Browse files Browse the repository at this point in the history
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
  • Loading branch information
Pavan-Nokia authored Sep 8, 2024
1 parent 08a1565 commit c9ec757
Showing 1 changed file with 19 additions and 3 deletions.
22 changes: 19 additions & 3 deletions platform/marvell/platform_armhf.conf
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,15 @@ demo_mnt=/tmp
FW_ENV_DEFAULT='/dev/mtd0 0x00500000 0x80000 0x100000 8'
UBOOT_FW_DEFAULT=1

defrag_file() {
echo "Defragment file: $1 (used by U-Boot)"
e4defrag $1 >/dev/null
if [ $? -ne 0 ]; then
echo "ERROR: defrag failed for $1"
exit 3
fi
}

prepare_boot_menu() {
echo "Sync up cache ..."
sync
Expand Down Expand Up @@ -100,15 +109,22 @@ prepare_boot_menu() {
echo $FW_ENV_DEFAULT > /etc/fw_env.config
echo "Using pre-configured uboot env"
fi

image_name=${image_dir}${kernel_fname}
initrd_name=${image_dir}${initrd_fname}
fdt_name=${image_dir}${fdt_fname}

if [ "$PLATFORM" = "armhf-nokia_ixs7215_52x-r0" ]; then
FW_ENV_DEFAULT='/dev/mtd0 0x00100000 0x10000 0x10000'
echo $FW_ENV_DEFAULT > /etc/fw_env.config
echo "Using pre-configured uboot env for armhf-nokia_ixs7215_52x-r0"
if [ "$install_env" != "onie" ]; then
defrag_file ${demo_mnt}/${image_name}
defrag_file ${demo_mnt}/${initrd_name}
defrag_file ${demo_mnt}/${fdt_name}
fi
fi

image_name=${image_dir}${kernel_fname}
initrd_name=${image_dir}${initrd_fname}
fdt_name=${image_dir}${fdt_fname}

if [ "$install_env" = "onie" ]; then
FW_ARG="-f"
Expand Down

0 comments on commit c9ec757

Please sign in to comment.