File tree Expand file tree Collapse file tree 2 files changed +12
-0
lines changed
Expand file tree Collapse file tree 2 files changed +12
-0
lines changed Original file line number Diff line number Diff line change @@ -1672,6 +1672,16 @@ int boot_linux_from_mmc(void)
16721672 return -1 ;
16731673 }
16741674
1675+ /* If lk2nd is installed on the mmc's boot partition,
1676+ * the device would repeat booting into lk2nd forever.
1677+ * Prevent this to happen.
1678+ */
1679+ char * hdr_cmdline_lk2nd_pos = strstr ((const char * )hdr -> cmdline , "lk2nd" );
1680+ if (hdr_cmdline_lk2nd_pos && * (hdr_cmdline_lk2nd_pos + strlen ("lk2nd" )) == '\0' ) {
1681+ dprintf (CRITICAL , "ERROR: lk2nd detected on partition %s\n" , ptn_name );
1682+ return ERR_REPEAT_BOOT_LK2ND ;
1683+ }
1684+
16751685 if (memcmp (hdr -> magic , BOOT_MAGIC , BOOT_MAGIC_SIZE )) {
16761686 dprintf (CRITICAL , "ERROR: Invalid boot image header\n" );
16771687 return ERR_INVALID_BOOT_MAGIC ;
@@ -5693,6 +5703,7 @@ void aboot_init(const struct app_descriptor *app)
56935703 case ERR_DT_PARSE :
56945704 case ERR_ABOOT_ADDR_OVERLAP :
56955705 case ERR_INVALID_BOOT_MAGIC :
5706+ case ERR_REPEAT_BOOT_LK2ND :
56965707 if (partition_multislot_is_supported ())
56975708 {
56985709 /*
Original file line number Diff line number Diff line change 235235 ERR_DECOMPRESSION ,
236236 ERR_DT_PARSE ,
237237 ERR_BOOT_SIGNATURE_MISMATCH ,
238+ ERR_REPEAT_BOOT_LK2ND ,
238239};
239240#endif
You can’t perform that action at this time.
0 commit comments