From 55681e46e3577b449eda0b6faef53b79e8e4b2b7 Mon Sep 17 00:00:00 2001 From: Adriana Kobylak Date: Wed, 11 Nov 2020 15:06:50 -0600 Subject: image_types_phosphor: mmc: Fill empty image with zeros There are errors seeing in the eMMC when the empty space of an image is filled with 0xff like it's done for NOR chips instead of 0s. Create a function to create empty images with 0s. Also create an empty image for u-boot of 1MB (twice its current size) so if the u-boot image that is flashed on a system is smaller than what the system has, there's no leftover data at the end that can cause issues. Tested: Booted the new image-u-boot file on HW. (From meta-phosphor rev: e4c3d766a0cda490758636f563572152a6ddfaa1) Change-Id: I27f31f76c38bc256b84cad566afa1e98471695db Signed-off-by: Adriana Kobylak Signed-off-by: Andrew Geissler --- meta-phosphor/classes/image_types_phosphor.bbclass | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) (limited to 'meta-phosphor/classes') diff --git a/meta-phosphor/classes/image_types_phosphor.bbclass b/meta-phosphor/classes/image_types_phosphor.bbclass index 39801204b..e4663471c 100644 --- a/meta-phosphor/classes/image_types_phosphor.bbclass +++ b/meta-phosphor/classes/image_types_phosphor.bbclass @@ -55,6 +55,7 @@ FLASH_UBI_RWFS_TXT_SIZE ?= "6MiB" FLASH_UBI_RWFS_TXT_SIZE_flash-131072 ?= "32MiB" # eMMC sizes in KB unless otherwise noted. +MMC_UBOOT_SIZE ?= "1024" MMC_BOOT_PARTITION_SIZE ?= "65536" SIGNING_KEY ?= "${STAGING_DIR_NATIVE}${datadir}/OpenBMC.priv" @@ -104,6 +105,12 @@ mk_empty_image() { | tr '\000' '\377' > $image_dst } +mk_empty_image_zeros() { + image_dst="$1" + image_size_kb=$2 + dd if=/dev/zero of=$image_dst bs=1k count=$image_size_kb +} + clean_rwfs() { type=$1 shift @@ -423,13 +430,14 @@ do_generate_ubi_tar[depends] += " \ do_generate_ext4_tar() { # Generate the U-Boot image + mk_empty_image_zeros image-u-boot ${MMC_UBOOT_SIZE} do_generate_image_uboot_file image-u-boot # Generate a compressed ext4 filesystem with the fitImage file in it to be # flashed to the boot partition of the eMMC install -d boot-image install -m 644 ${DEPLOY_DIR_IMAGE}/${FLASH_KERNEL_IMAGE} boot-image/fitImage - mk_empty_image boot-image.${FLASH_EXT4_BASETYPE} ${MMC_BOOT_PARTITION_SIZE} + mk_empty_image_zeros boot-image.${FLASH_EXT4_BASETYPE} ${MMC_BOOT_PARTITION_SIZE} mkfs.ext4 -F -i 4096 -d boot-image boot-image.${FLASH_EXT4_BASETYPE} # Error codes 0-3 indicate successfull operation of fsck fsck.ext4 -pvfD boot-image.${FLASH_EXT4_BASETYPE} || [ $? -le 3 ] -- cgit v1.2.3