diff --git a/configs/am335x_nmhw21_defconfig b/configs/am335x_nmhw21_defconfig index d798c71886..66319dc4f8 100644 --- a/configs/am335x_nmhw21_defconfig +++ b/configs/am335x_nmhw21_defconfig @@ -47,3 +47,4 @@ CONFIG_OF_LIBFDT=y # CONFIG_EFI_LOADER is not set # CONFIG_CMD_LOADB is not set # CONFIG_CMD_LOADS is not set +CONFIG_BOOTCOUNT_LIMIT=y diff --git a/include/configs/am335x_nmhw21.h b/include/configs/am335x_nmhw21.h index 7fa2a77ba1..dd146e7e2d 100644 --- a/include/configs/am335x_nmhw21.h +++ b/include/configs/am335x_nmhw21.h @@ -55,7 +55,8 @@ int eth_phy_timeout(void); #undef CONFIG_NET_RETRY_COUNT #define CONFIG_NET_RETRY_COUNT 5 #define CONFIG_BOOTP_MAY_FAIL - +#define CONFIG_BOOTCOUNT_LIMIT +#define CONFIG_BOOTCOUNT_AM33XX #ifndef CONFIG_SPL_BUILD @@ -102,14 +103,27 @@ int eth_phy_timeout(void); "ethprime=cpsw\0" \ "ethopts=ti_cpsw.rx_packet_max=1526\0" \ "bootcmd_otenv=ext4load mmc 1:1 $load_addr /boot/loader/uEnv.txt; " \ - "env import -t $load_addr $filesize; " \ - "setenv bootargs $bootargs root=/dev/ram0 console=$defaultconsole,115200 " \ - "$ethopts rw ostree_root=/dev/mmcblk1p1\0" \ - "bootcmd_rd_in_mmc=ext4load mmc 1:1 $kernel_addr_r /boot$kernel_image; " \ + "env import -t $load_addr $filesize\0" \ + "bootcmd_ostree=setenv bootargs $bootargs root=/dev/ram0 console=$defaultconsole,115200 panic=1 $ethopts rw ostree_root=/dev/mmcblk1p1;" \ + "ext4load mmc 1:1 $kernel_addr_r /boot$kernel_image; " \ "ext4load mmc 1:1 $ramdisk_addr_r /boot$ramdisk_image; " \ "bootm $kernel_addr_r $ramdisk_addr_r\0" \ - "bootcmd=run bootcmd_otenv; run bootcmd_rd_in_mmc\0" \ + "bootcmd_ostree_fb=setenv bootargs $bootargs2 root=/dev/ram0 console=$defaultconsole,115200 panic=1 $ethopts rw ostree_root=/dev/mmcblk1p1; " \ + "ext4load mmc 1:1 $kernel_addr_r /boot$kernel_image2; " \ + "ext4load mmc 1:1 $ramdisk_addr_r /boot$ramdisk_image2; " \ + "bootm $kernel_addr_r $ramdisk_addr_r\0" \ + "bootcmd=run bootcmd_otenv; " \ + "if test $bootcount < 3; then " \ + "echo \"Booting ostree...\"; " \ + "run bootcmd_ostree; fi; " \ + "if test $bootcount > 6 || test ! -n $kernel_image2; then " \ + "echo \"Booting recovery...\"; " \ + "run recovery; fi; " \ + "if test -n $kernel_image2; then " \ + "echo \"Booting ostree fallback system...\"; " \ + "run bootcmd_ostree_fb; fi\0" \ "bootdelay=0\0" \ + "bootcount=1\0" \ "ipaddr=192.168.1.1\0" \ "serverip=192.168.1.254\0" \ "tftptimeout=2000\0" \