From: Marek Szyprowski Date: Fri, 22 Jan 2021 10:24:04 +0000 (+0100) Subject: samsung: tizen_rpi: check MBR partition layout from preboot X-Git-Tag: accepted/tizen/unified/20231106.171643~164 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=7689a14adac78de876caabeef3a195d19b6573b5;p=platform%2Fkernel%2Fu-boot.git samsung: tizen_rpi: check MBR partition layout from preboot Verify if the MBR partition layout on SD card matches the one defined in the bootloader. Signed-off-by: Marek Szyprowski Change-Id: I7c296a4f64e294a9dc510e0a248e83375bacf9cb --- diff --git a/configs/rpi_3_32b_defconfig b/configs/rpi_3_32b_defconfig index 4b7195b..b1445b7 100644 --- a/configs/rpi_3_32b_defconfig +++ b/configs/rpi_3_32b_defconfig @@ -14,6 +14,7 @@ CONFIG_SYS_LOAD_ADDR=0x1000000 CONFIG_BOOTSTD_DEFAULTS=y CONFIG_OF_BOARD_SETUP=y CONFIG_USE_PREBOOT=y +CONFIG_PREBOOT="run mbr_check" # CONFIG_DISPLAY_CPUINFO is not set # CONFIG_DISPLAY_BOARDINFO is not set CONFIG_MISC_INIT_R=y diff --git a/configs/rpi_3_defconfig b/configs/rpi_3_defconfig index 82bf258..9525a1c 100644 --- a/configs/rpi_3_defconfig +++ b/configs/rpi_3_defconfig @@ -13,6 +13,7 @@ CONFIG_SYS_LOAD_ADDR=0x1000000 CONFIG_BOOTSTD_DEFAULTS=y CONFIG_OF_BOARD_SETUP=y CONFIG_USE_PREBOOT=y +CONFIG_PREBOOT="run mbr_check" # CONFIG_DISPLAY_CPUINFO is not set # CONFIG_DISPLAY_BOARDINFO is not set CONFIG_MISC_INIT_R=y diff --git a/configs/rpi_4_32b_defconfig b/configs/rpi_4_32b_defconfig index af3e87b..2a45f37 100644 --- a/configs/rpi_4_32b_defconfig +++ b/configs/rpi_4_32b_defconfig @@ -13,7 +13,7 @@ CONFIG_PCI=y CONFIG_BOOTSTD_DEFAULTS=y CONFIG_OF_BOARD_SETUP=y CONFIG_USE_PREBOOT=y -CONFIG_PREBOOT="pci enum; usb start;" +CONFIG_PREBOOT="pci enum; usb start; run mbr_check" CONFIG_SYS_STDIO_DEREGISTER=y # CONFIG_DISPLAY_CPUINFO is not set # CONFIG_DISPLAY_BOARDINFO is not set diff --git a/configs/rpi_4_defconfig b/configs/rpi_4_defconfig index 9bce141..97b146c 100644 --- a/configs/rpi_4_defconfig +++ b/configs/rpi_4_defconfig @@ -13,7 +13,7 @@ CONFIG_PCI=y CONFIG_BOOTSTD_DEFAULTS=y CONFIG_OF_BOARD_SETUP=y CONFIG_USE_PREBOOT=y -CONFIG_PREBOOT="pci enum; usb start;" +CONFIG_PREBOOT="pci enum; usb start; run mbr_check" CONFIG_SYS_STDIO_DEREGISTER=y # CONFIG_DISPLAY_CPUINFO is not set # CONFIG_DISPLAY_BOARDINFO is not set diff --git a/include/samsung/tizen_rpi.h b/include/samsung/tizen_rpi.h index 06717b5..08f22ed 100644 --- a/include/samsung/tizen_rpi.h +++ b/include/samsung/tizen_rpi.h @@ -55,6 +55,15 @@ "name=reserved2,size=125M,id=0x83;" \ "" +#define MBR_CHECK \ + "env default mbr_parts; " \ + "if mbr verify ${dfu_interface} ${dfu_device}; " \ + "then true; else " \ + "echo \"MBR partition layout does not match flashed bootloader!\"; " \ + "echo \"Please format SD card with recent sd_fusing_rpi3.sh script or Ctrl-C to continue.\"; " \ + "while sleep 2; do echo .\\\\\\\\c; done; echo; " \ + "fi" + #ifdef CONFIG_TARGET_RPI_4_32B #define TIZEN_VC_MEM "vc_mem.mem_base=0x3ec00000 vc_mem.mem_size=0x40000000 swiotlb=8192 " #else @@ -104,6 +113,7 @@ "dfu_interface=mmc\0" \ "dfu_device=" __stringify(CONFIG_MMC_DEFAULT_DEV) "\0" \ "mbr_parts=" PARTS_DEFAULT "\0" \ + "mbr_check=" MBR_CHECK "\0" \ "" #endif /* __CONFIG_TIZEN_RPI_H */