From: Moses Christopher Date: Wed, 25 Mar 2020 06:45:47 +0000 (+0000) Subject: am335x, guardian: load env from NAND X-Git-Url: http://git.dujemihanovic.xyz/login.html?a=commitdiff_plain;h=a31216772a709b39b34af3853d7c62019902233a;p=u-boot.git am335x, guardian: load env from NAND - As there is a requirement to store certain data, we need a persistent storage in u-boot. Hence, we need to save env in NAND - Add default Guardian environment variables - Update partition table: - Reserve some space for experimentation, this ensures proper backwards compatibility - Update defconfig accordingly Signed-off-by: Moses Christopher --- diff --git a/arch/arm/dts/am335x-guardian.dts b/arch/arm/dts/am335x-guardian.dts index b554be97a3..7e70a96d25 100644 --- a/arch/arm/dts/am335x-guardian.dts +++ b/arch/arm/dts/am335x-guardian.dts @@ -202,8 +202,33 @@ }; partition@6 { + label = "u-boot-2"; + reg = <0x300000 0x100000>; + }; + + partition@7 { + label = "u-boot-2.backup1"; + reg = <0x400000 0x100000>; + }; + + partition@8 { + label = "u-boot-env"; + reg = <0x500000 0x40000>; + }; + + partition@9 { + label = "u-boot-env.backup1"; + reg = <0x540000 0x40000>; + }; + + partition@10 { + label = "splash-screen"; + reg = <0x580000 0x40000>; + }; + + partition@11 { label = "UBI"; - reg = <0x300000 0x1fd00000>; + reg = <0x5c0000 0x1fa40000>; }; }; }; diff --git a/configs/am335x_guardian_defconfig b/configs/am335x_guardian_defconfig index 6bd5f0a9e5..b0033810b9 100644 --- a/configs/am335x_guardian_defconfig +++ b/configs/am335x_guardian_defconfig @@ -5,6 +5,7 @@ CONFIG_SPL_GPIO_SUPPORT=y CONFIG_SPL_LIBCOMMON_SUPPORT=y CONFIG_SPL_LIBGENERIC_SUPPORT=y CONFIG_ENV_SIZE=0x40000 +CONFIG_ENV_OFFSET=0x500000 CONFIG_AM33XX=y CONFIG_TARGET_AM335X_GUARDIAN=y CONFIG_SPL_SERIAL_SUPPORT=y @@ -22,6 +23,11 @@ CONFIG_ARCH_MISC_INIT=y # CONFIG_SPL_RAW_IMAGE_SUPPORT is not set CONFIG_SPL_SEPARATE_BSS=y # CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_USE_SECTOR is not set +CONFIG_ENV_IS_IN_NAND=y +CONFIG_SYS_REDUNDAND_ENVIRONMENT=y +CONFIG_ENV_OFFSET_REDUND=0x540000 +CONFIG_SYS_RELOC_GD_ENV_ADDR=y +CONFIG_SPL_ENV_IS_NOWHERE=y CONFIG_SPL_ENV_SUPPORT=y CONFIG_SPL_ETH_SUPPORT=y CONFIG_SPL_I2C_SUPPORT=y @@ -49,7 +55,7 @@ CONFIG_CMD_USB=y # CONFIG_CMD_SETEXPR is not set CONFIG_CMD_EXT4_WRITE=y CONFIG_CMD_MTDPARTS=y -CONFIG_MTDPARTS_DEFAULT="mtdparts=nand.0:256k(SPL),256k(SPL.backup1),256k(SPL.backup2),256k(SPL.backup3),1m(u-boot),1m(u-boot.backup1),-(UBI)" +CONFIG_MTDPARTS_DEFAULT="mtdparts=nand.0:256k(SPL),256k(SPL.backup1),256k(SPL.backup2),256k(SPL.backup3),1m(u-boot),1m(u-boot.backup1),1m(u-boot-2),1m(u-boot-2.backup1),256k(u-boot-env),256k(u-boot-env.backup1),256k(splash-screen),-(UBI)" CONFIG_CMD_UBI=y # CONFIG_SPL_DOS_PARTITION is not set # CONFIG_ISO_PARTITION is not set @@ -57,7 +63,6 @@ CONFIG_CMD_UBI=y CONFIG_OF_CONTROL=y # CONFIG_SPL_OF_CONTROL is not set CONFIG_DEFAULT_DEVICE_TREE="am335x-guardian" -CONFIG_SYS_RELOC_GD_ENV_ADDR=y CONFIG_SPL_DM=y CONFIG_BOOTCOUNT_LIMIT=y CONFIG_BOOTCOUNT_AM33XX=y diff --git a/include/configs/am335x_guardian.h b/include/configs/am335x_guardian.h index 3c6147a266..1ac5e2e240 100644 --- a/include/configs/am335x_guardian.h +++ b/include/configs/am335x_guardian.h @@ -42,10 +42,23 @@ #include +#define GUARDIAN_DEFAULT_PROD_ENV \ + "factory_assembly_status=0\0" \ + "main_pcba_part_number=0\0" \ + "main_pcba_supplier=0\0" \ + "main_pcba_timestamp=0\0" \ + "main_pcba_hardware_version=0\0" \ + "main_pcba_id=0\0" \ + "main_pcba_aux_1=0\0" \ + "main_pcba_aux_2=0\0" \ + "main_pcba_aux_3=0\0" \ + "main_pcba_aux_4=0\0" \ + #define CONFIG_EXTRA_ENV_SETTINGS \ AM335XX_BOARD_FDTFILE \ MEM_LAYOUT_ENV_SETTINGS \ BOOTENV \ + GUARDIAN_DEFAULT_PROD_ENV \ "bootubivol=rootfs\0" \ "altbootcmd=" \ "setenv boot_config \"extlinux-rollback.conf\"; " \