Message ID | 20171116092231.27740-10-maxime.ripard@free-electrons.com |
---|---|
State | Superseded |
Headers | show |
Series | env: Multiple env support and env transition for sunxi | expand |
On Thu, 16 Nov 2017 10:22:30 +0100 Maxime Ripard <maxime.ripard@free-electrons.com> wrote: > The current environment has been hardcoded to an offset that starts > to be an issue given the current size of our main U-Boot binary. > > By implementing a custom environment location routine, we can always > favor the FAT-based environment, and fallback to the MMC if we don't > find something in the FAT partition. We also implement the same order > when saving the environment, so that hopefully we can slowly migrate > the users over to FAT-based environment and away from the raw MMC one. > > Eventually, and hopefully before we reach that limit again, we will > have most of our users using that setup, and we'll be able to retire > the raw environment, and gain more room for the U-Boot binary. > > Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com> > --- > board/sunxi/board.c | 16 ++++++++++++++++ > 1 file changed, 16 insertions(+) > > diff --git a/board/sunxi/board.c b/board/sunxi/board.c > index dcacdf3e626d..8891961dcc6b 100644 > --- a/board/sunxi/board.c > +++ b/board/sunxi/board.c > @@ -173,6 +173,22 @@ void i2c_init_board(void) > #endif > } > > +#if defined(CONFIG_ENV_IS_IN_MMC) && defined(CONFIG_ENV_IS_IN_FAT) > +enum env_location env_get_location(enum env_operation op, int prio) > +{ > + switch (prio) { > + case 0: > + return ENVL_FAT; > + > + case 1: > + return ENVL_MMC; > + > + default: > + return ENVL_UNKNOWN; > + } > +} > +#endif > + > /* add board specific code here */ > int board_init(void) > { Reviewed-by: Lukasz Majewski <lukma@denx.de> Best regards, Lukasz Majewski -- DENX Software Engineering GmbH, Managing Director: Wolfgang Denk HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd@denx.de
diff --git a/board/sunxi/board.c b/board/sunxi/board.c index dcacdf3e626d..8891961dcc6b 100644 --- a/board/sunxi/board.c +++ b/board/sunxi/board.c @@ -173,6 +173,22 @@ void i2c_init_board(void) #endif } +#if defined(CONFIG_ENV_IS_IN_MMC) && defined(CONFIG_ENV_IS_IN_FAT) +enum env_location env_get_location(enum env_operation op, int prio) +{ + switch (prio) { + case 0: + return ENVL_FAT; + + case 1: + return ENVL_MMC; + + default: + return ENVL_UNKNOWN; + } +} +#endif + /* add board specific code here */ int board_init(void) {
The current environment has been hardcoded to an offset that starts to be an issue given the current size of our main U-Boot binary. By implementing a custom environment location routine, we can always favor the FAT-based environment, and fallback to the MMC if we don't find something in the FAT partition. We also implement the same order when saving the environment, so that hopefully we can slowly migrate the users over to FAT-based environment and away from the raw MMC one. Eventually, and hopefully before we reach that limit again, we will have most of our users using that setup, and we'll be able to retire the raw environment, and gain more room for the U-Boot binary. Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com> --- board/sunxi/board.c | 16 ++++++++++++++++ 1 file changed, 16 insertions(+)