Skip to contentSkip to conversation

mx28evk environment rework for NAND support

PATCH RESEND New Otavio Salvador 4 participants 15 messages Oct 21, 2013 – Oct 28, 2013

lore
Share & tools
lore
#0 lore raw

cover mx28evk environment rework for NAND support

This patchset improves the mx28evk default environment so it is easier to use by users when testing the NAND support.

It provides a set of new environment routines as:

- update_nand_kernel
- update_nand_fdt
- update_nand_filesystem

and allow for easy NAND boot using:

'run nandboot'

This has been tested using:

Samsung 4G NAND, part-#: K9LBG08U0D-PCB0

Otavio Salvador (3):
mx28evk: Use 512k for fdt partition to align it
mx28evk: Add 'nandboot' environment command
mx28evk: Extend environment to easy write of NAND system

 include/configs/mx28evk.h | 55 ++++++++++++++++++++++++++++++++++++++++++++---
 1 file changed, 52 insertions(+), 3 deletions(-)
Signature · 1 line
1.8.4.rc3
#1 lore raw

PATCH RESEND 1/3 mx28evk: Use 512k for fdt partition to align it

Using 512k for fdt partition allow it to be aligned with the other small partitions and 512k erase block size.

---
 include/configs/mx28evk.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
include/configs/mx28evk.h +1 -1
index 07f88ca..27b1a41 100644
@@ -97,7 +97,7 @@
 		"512k(environment),"		\
 		"512k(redundant-environment),"	\
 		"4m(kernel),"			\
-		"128k(fdt),"			\
+		"512k(fdt),"			\
 		"8m(ramdisk),"			\
 		"-(filesystem)"
 #endif
Signature · 1 line
1.8.4.rc3
#2 lore raw

PATCH RESEND 2/3 mx28evk: Add 'nandboot' environment command

In reply to Otavio Salvador

This reads the kernel, ftd and boot into ubifs filesystem. While on that, the SD firmware filename definition has been moved next to the other SD related commands.

---
 include/configs/mx28evk.h | 18 +++++++++++++++++-
 1 file changed, 17 insertions(+), 1 deletion(-)
include/configs/mx28evk.h +17 -1
index 27b1a41..e40df09 100644
@@ -163,7 +163,6 @@
 #define CONFIG_EXTRA_ENV_SETTINGS \
 	"update_nand_full_filename=u-boot.nand\0" \
 	"update_nand_firmware_filename=u-boot.sb\0"	\
-	"update_sd_firmware_filename=u-boot.sd\0" \
 	"update_nand_firmware_maxsz=0x100000\0"	\
 	"update_nand_stride=0x40\0"	/* MX28 datasheet ch. 12.12 */ \
 	"update_nand_count=0x4\0"	/* MX28 datasheet ch. 12.12 */ \
@@ -191,6 +190,23 @@
 		"nand write ${loadaddr} ${fcb_sz} ${filesize} ; " \
 		"nand write ${loadaddr} ${fw_off} ${filesize} ; " \
 		"fi\0" \
+	"nandargs=setenv bootargs console=${console_mainline},${baudrate} " \
+		"rootfstype=ubifs ubi.mtd=6 root=ubi0_0 ${mtdparts}\0" \
+	"nandboot="		/* Boot from NAND */ \
+		"mtdparts default; " \
+		"run nandargs; " \
+		"nand read ${loadaddr} kernel 0x00400000; " \
+		"if test ${boot_fdt} = yes; then " \
+			"nand read ${fdt_addr} fdt 0x00080000; " \
+			"bootm ${loadaddr} - ${fdt_addr}; " \
+		"else " \
+			"if test ${boot_fdt} = no; then " \
+				"bootm; " \
+			"else " \
+				"echo \"ERROR: Set boot_fdt to yes or no.\"; " \
+			"fi; " \
+		"fi\0" \
+	"update_sd_firmware_filename=u-boot.sd\0" \
 	"update_sd_firmware="		/* Update the SD firmware partition */ \
 		"if mmc rescan ; then "	\
 		"if tftp ${update_sd_firmware_filename} ; then " \
Signature · 1 line
1.8.4.rc3
#3 lore raw

PATCH RESEND 2/3 mx28evk: Add 'nandboot' environment command

Dear Otavio Salvador,

Quoted 5 lines

This reads the kernel, ftd and boot into ubifs filesystem. While on that, the SD firmware filename definition has been moved next to the other SD related commands.

Any changes to built-in environment are now NAKd I believe.

Best regards,
Marek Vasut

#4 lore raw

PATCH RESEND 2/3 mx28evk: Add 'nandboot' environment command

Quoted 9 lines · Marek Vasut

Dear Otavio Salvador,

Quoted 5 lines

This reads the kernel, ftd and boot into ubifs filesystem. While on that, the SD firmware filename definition has been moved next to the other SD related commands.

Any changes to built-in environment are now NAKd I believe.

I don't see a reason to not merged it for now; I will work in porting the environments for the external file but this could go now, anyway.

Signature · 3 lines
Otavio Salvador                             O.S. Systems
http://www.ossystems.com.br        http://code.ossystems.com.br
Mobile: +55 (53) 9981-7854            Mobile: +1 (347) 903-9750
#5 lore raw

PATCH RESEND 2/3 mx28evk: Add 'nandboot' environment command

Dear Otavio Salvador,

Quoted 7 lines · Marek Vasut
Quoted 6 lines

Dear Otavio Salvador,

Quoted 4 lines

This reads the kernel, ftd and boot into ubifs filesystem. While on that, the SD firmware filename definition has been moved next to the other SD related commands.

Quoted 6 lines
Quoted 3 lines
Quoted 1 line

Any changes to built-in environment are now NAKd I believe.

I don't see a reason to not merged it for now; I will work in porting the environments for the external file but this could go now, anyway.

Read [1], in particular what Stefano said.

http://comments.gmane.org/gmane.comp.boot-loaders.u-boot/169042

Thus this patch shall be rejected as well, sorry.

Best regards,
Marek Vasut

#6 lore raw

PATCH RESEND 2/3 mx28evk: Add 'nandboot' environment command

Hello,

I am not sure I agree ...

Quoted 13 lines · Marek Vasut

Dear Otavio Salvador,

Quoted 11 lines · Marek Vasut
Quoted 9 lines

Dear Otavio Salvador,

Quoted 5 lines

This reads the kernel, ftd and boot into ubifs filesystem. While on that, the SD firmware filename definition has been moved next to the other SD related commands.

Any changes to built-in environment are now NAKd I believe.

Quoted 8 lines
Quoted 2 lines

I don't see a reason to not merged it for now; I will work in porting the environments for the external file but this could go now, anyway.

Read [1], in particular what Stefano said.

http://comments.gmane.org/gmane.comp.boot-loaders.u-boot/169042

Thus this patch shall be rejected as well, sorry.

I agree with the goal but until we have a way to insert the /default/ environment into the binary of U-Boot for use (not adding an extra environment image) this should be accepted.

Signature · 3 lines
Otavio Salvador                             O.S. Systems
http://www.ossystems.com.br        http://code.ossystems.com.br
Mobile: +55 (53) 9981-7854            Mobile: +1 (347) 903-9750
#7 lore raw

PATCH RESEND 2/3 mx28evk: Add 'nandboot' environment command

Dear Otavio Salvador,

Quoted 23 lines

Hello,

I am not sure I agree ...

Quoted 18 lines · Marek Vasut

Dear Otavio Salvador,

Quoted 7 lines · Marek Vasut
Quoted 6 lines

Dear Otavio Salvador,

Quoted 4 lines

This reads the kernel, ftd and boot into ubifs filesystem. While on that, the SD firmware filename definition has been moved next to the other SD related commands.

Quoted 6 lines
Quoted 3 lines
Quoted 1 line

Any changes to built-in environment are now NAKd I believe.

I don't see a reason to not merged it for now; I will work in porting the environments for the external file but this could go now, anyway.

Read [1], in particular what Stefano said.

Quoted 7 lines
Quoted 3 lines

http://comments.gmane.org/gmane.comp.boot-loaders.u-boot/169042

Thus this patch shall be rejected as well, sorry.

I agree with the goal but until we have a way to insert the /default/ environment into the binary of U-Boot for use (not adding an extra environment image) this should be accepted.

I disagree with the decision to reject the envs as well, I just present previous discussion here. I will pull out of this discussion and leave the rest up to Stefano, since this is his call afterall.

Best regards,
Marek Vasut

#8 lore raw

PATCH RESEND 2/3 mx28evk: Add 'nandboot' environment command

In reply to Otavio Salvador

Hi Otavio,

Quoted 23 lines · Otavio Salvador

Hello,

I am not sure I agree ...

Quoted 18 lines · Marek Vasut

Dear Otavio Salvador,

Quoted 7 lines · Marek Vasut
Quoted 6 lines

Dear Otavio Salvador,

Quoted 4 lines

This reads the kernel, ftd and boot into ubifs filesystem. While on that, the SD firmware filename definition has been moved next to the other SD related commands.

Quoted 6 lines
Quoted 3 lines
Quoted 1 line

Any changes to built-in environment are now NAKd I believe.

I don't see a reason to not merged it for now; I will work in porting the environments for the external file but this could go now, anyway.

Read [1], in particular what Stefano said.

Quoted 7 lines
Quoted 3 lines

http://comments.gmane.org/gmane.comp.boot-loaders.u-boot/169042

Thus this patch shall be rejected as well, sorry.

I agree with the goal but until we have a way to insert the /default/ environment into the binary of U-Boot for use (not adding an extra environment image) this should be accepted.

Indeed. However, why cannot we do the right thing soon ?

It is very interesting if Simon's patches will flow into mainline soon - as feeling, I see some comments by Wolfgang, but no evident signal that they will be stopped. Octavio, I will wait for your patches for a while and if Simon's patches will be accepted soon, I will kindly ask you to reformat your patches, moving the default environment into an .env file.

Best regards,
Stefano Babic

Signature · 5 lines
=====================================================================
DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: +49-8142-66989-53 Fax: +49-8142-66989-80 Email: sbabic at denx.de
=====================================================================
#9 lore raw

PATCH RESEND 2/3 mx28evk: Add 'nandboot' environment command

Quoted 28 lines · Stefano Babic

Hi Otavio,

Quoted 25 lines · Otavio Salvador

Hello,

I am not sure I agree ...

Quoted 20 lines · Marek Vasut

Dear Otavio Salvador,

Quoted 7 lines · Marek Vasut
Quoted 6 lines

Dear Otavio Salvador,

Quoted 4 lines

This reads the kernel, ftd and boot into ubifs filesystem. While on that, the SD firmware filename definition has been moved next to the other SD related commands.

Quoted 6 lines
Quoted 3 lines
Quoted 1 line

Any changes to built-in environment are now NAKd I believe.

I don't see a reason to not merged it for now; I will work in porting the environments for the external file but this could go now, anyway.

Read [1], in particular what Stefano said.

http://comments.gmane.org/gmane.comp.boot-loaders.u-boot/169042

Quoted 7 lines
Quoted 5 lines
Quoted 1 line

Thus this patch shall be rejected as well, sorry.

I agree with the goal but until we have a way to insert the /default/ environment into the binary of U-Boot for use (not adding an extra environment image) this should be accepted.

Indeed. However, why cannot we do the right thing soon ?

There're no pending patches to address the root problem yet (allowing changing /internal and default/ environment).

Quoted 5 lines

It is very interesting if Simon's patches will flow into mainline soon - as feeling, I see some comments by Wolfgang, but no evident signal that they will be stopped. Octavio, I will wait for your patches for a while and if Simon's patches will be accepted soon, I will kindly ask you to reformat your patches, moving the default environment into an .env file.

I will rework the environments as .env files but I don't want to hold this change until this is accepted.

My patch is fine and could go in now as is. Once Simon's patches get in I will post another series reworking the environment to convert it to the .env file format but please don't block on this.

Signature · 3 lines
Otavio Salvador                             O.S. Systems
http://www.ossystems.com.br        http://code.ossystems.com.br
Mobile: +55 (53) 9981-7854            Mobile: +1 (347) 903-9750
#10 lore raw

PATCH RESEND 2/3 mx28evk: Add 'nandboot' environment command

Dear Otavio,

Quoted 5 lines · In message <CAP9ODKpN+PMX1HP+7bEMP7u-Hc44oNc6PEpAn+nbzbQm8cDfrg@mail.gmail.com>…
Quoted 2 lines

Indeed. However, why cannot we do the right thing soon ?

There're no pending patches to address the root problem yet (allowing changing /internal and default/ environment).

Simon's patch set "env: Add support for environment files" does exactly that.

Quoted 2 lines

I will rework the environments as .env files but I don't want to hold this change until this is accepted.

Please be patient, like we all are. It's better to wait a bit now, then adding work now, and adding more work later to clean up the mess again.

Quoted 3 lines

My patch is fine and could go in now as is. Once Simon's patches get in I will post another series reworking the environment to convert it to the .env file format but please don't block on this.

I agree with Stefano that we should not add more to the already existing amount of env settings but instead wait for a cleaner way. Please be patient - you lose nothing here.

Best regards,

Wolfgang Denk

Signature · 6 lines
DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
C makes it easy for you to shoot yourself in the foot. C++ makes that
harder, but when you do, it blows away your whole leg.
                                                 -- Bjarne Stroustrup
#11 lore raw

PATCH RESEND 2/3 mx28evk: Add 'nandboot' environment command

Quoted 11 lines · Wolfgang Denk

Dear Otavio,

Quoted 5 lines · In message <CAP9ODKpN+PMX1HP+7bEMP7u-Hc44oNc6PEpAn+nbzbQm8cDfrg@mail.gmail.com>…
Quoted 2 lines

Indeed. However, why cannot we do the right thing soon ?

There're no pending patches to address the root problem yet (allowing changing /internal and default/ environment).

Simon's patch set "env: Add support for environment files" does exactly that.

Doing it without changing source code, directly into the binary?

#12 lore raw

PATCH RESEND 2/3 mx28evk: Add 'nandboot' environment command

Dear Otavio,

Quoted 5 lines · In message <CAP9ODKq0Ac6azBOav7R54RncB9=mhtMZ+hydjY0UiYUSCS1O0A@mail.gmail.com>…
Quoted 3 lines

Simon's patch set "env: Add support for environment files" does exactly that.

Doing it without changing source code, directly into the binary?

Yes.

Quoted 3 lines

From what I read it allows import / export but this is at runtime, I need it /before/ booting the board. So currently I need to patch the environment files for it.

Please re-read it again.

Quoted 5 lines
Quoted 3 lines

Please be patient, like we all are. It's better to wait a bit now, then adding work now, and adding more work later to clean up the mess again.

The work has already been done.

Yes, but that's actually your own problem; it seems you ignored the previous discussion.

Best regards,

Wolfgang Denk

Signature · 5 lines
DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
"Bureaucracy is the enemy of innovation."
       - Mark Shepherd, former President and CEO of Texas Instruments
#13 lore raw

PATCH RESEND 2/3 mx28evk: Add 'nandboot' environment command

In reply to Otavio Salvador

Hi Otavio,

Quoted 10 lines · Otavio Salvador
Quoted 9 lines · Wolfgang Denk

Dear Otavio,

Quoted 5 lines · In message <CAP9ODKpN+PMX1HP+7bEMP7u-Hc44oNc6PEpAn+nbzbQm8cDfrg@mail.gmail.com>…
Quoted 2 lines

Indeed. However, why cannot we do the right thing soon ?

There're no pending patches to address the root problem yet (allowing changing /internal and default/ environment).

Quoted 8 lines
Quoted 2 lines

Simon's patch set "env: Add support for environment files" does exactly that.

Doing it without changing source code, directly into the binary?

From what I read it allows import / export but this is at runtime, I need it /before/ booting the board. So currently I need to patch the environment files for it.

The way I see with Simon's patch is to define a .env file for each use case we can have. Because the environment is outside the configuration file, we could select the right environment when we produce the binary.

Let's say we have two environments, one defined from you and the other as "debian" environment. We could select the desired environment at build time by the make command or adding an entry into boards.cfg, exactly as we do now to select the imximage file with IMX_CONFIG (same sources, different imximage.cfg).

I understand that even with Simon's patches we will not have a way to have separate u-boot nad environment binaries, and then merge them together. However, we have a way to select which environment type (distro, minimal, ..) at build time.

Quoted 14 lines
Quoted 7 lines
Quoted 3 lines

I will rework the environments as .env files but I don't want to hold this change until this is accepted.

Please be patient, like we all are. It's better to wait a bit now, then adding work now, and adding more work later to clean up the mess again.

The work has already been done.

Quoted 4 lines
Quoted 3 lines

My patch is fine and could go in now as is. Once Simon's patches get in I will post another series reworking the environment to convert it to the .env file format but please don't block on this.

Quoted 7 lines
Quoted 3 lines

I agree with Stefano that we should not add more to the already existing amount of env settings but instead wait for a cleaner way. Please be patient - you lose nothing here.

I really see no point in holding it as the work has been done already; it is Stefano call but I disagree with postpone it as work is done and being in use.

Another example is maybe not in your "wandboard: add Future Eletronics 7" WVGA LCD extension board". In that patch, you add a lot of stuff inside CONFIG_EXTRA_ENV, that is perfectly suitable for your needs, but it is maybe not suitable for someone else who has not a display or maybe another LCD. But again, it fits then perfectly if we define different .env files, and it is possible to select one of them at build time.

It is then not exactly as we started, that is having two different images (u-boot and environemnt) and finding a way to merge them together, but it is quite close.

Quoted 3 lines

I will comment on Simon's patch to clarify my understanding there.

Fine, I will follow the discussion.

Best regards,
Stefano Babic

Signature · 5 lines
=====================================================================
DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: +49-8142-66989-53 Fax: +49-8142-66989-80 Email: sbabic at denx.de
=====================================================================
#14 lore raw

PATCH RESEND 3/3 mx28evk: Extend environment to easy write of NAND system

In reply to Otavio Salvador

This adds following new targets:

- update_nand_kernel
- update_nand_fdt
- update_nand_filesystem

and to avoid confusion, the 'update_nand_full' has been renamed to 'update_nand_firmware_full'.

---
 include/configs/mx28evk.h | 35 ++++++++++++++++++++++++++++++++++-
 1 file changed, 34 insertions(+), 1 deletion(-)
include/configs/mx28evk.h +34 -1
index e40df09..5e43226 100644
@@ -161,6 +161,7 @@
 
 /* Extra Environment */
 #define CONFIG_EXTRA_ENV_SETTINGS \
+	"ubifs_file=filesystem.ubifs\0" \
 	"update_nand_full_filename=u-boot.nand\0" \
 	"update_nand_firmware_filename=u-boot.sb\0"	\
 	"update_nand_firmware_maxsz=0x100000\0"	\
@@ -171,7 +172,7 @@
 		"nand info ; " \
 		"setexpr fcb_sz ${update_nand_stride} * ${update_nand_count};" \
 		"setexpr update_nand_fcb ${fcb_sz} * ${nand_writesize}\0" \
-	"update_nand_full="		    /* Update FCB, DBBT and FW */ \
+	"update_nand_firmware_full=" /* Update FCB, DBBT and FW */ \
 		"if tftp ${update_nand_full_filename} ; then " \
 		"run update_nand_get_fcb_size ; " \
 		"nand scrub -y 0x0 ${filesize} ; " \
@@ -190,6 +191,38 @@
 		"nand write ${loadaddr} ${fcb_sz} ${filesize} ; " \
 		"nand write ${loadaddr} ${fw_off} ${filesize} ; " \
 		"fi\0" \
+	"update_nand_kernel="		/* Update kernel */ \
+		"mtdparts default; " \
+		"nand erase.part kernel; " \
+		"if test ${ip_dyn} = yes; then " \
+			"setenv get_cmd dhcp; " \
+		"else " \
+			"setenv get_cmd tftp; " \
+		"fi; " \
+		"${get_cmd} ${uimage}; " \
+		"nand write ${loadaddr} kernel ${filesize}\0" \
+	"update_nand_fdt="		/* Update fdt */ \
+		"mtdparts default; " \
+		"nand erase.part fdt; " \
+		"if test ${ip_dyn} = yes; then " \
+			"setenv get_cmd dhcp; " \
+		"else " \
+			"setenv get_cmd tftp; " \
+		"fi; " \
+		"${get_cmd} ${fdt_file}; " \
+		"nand write ${loadaddr} fdt ${filesize}\0" \
+	"update_nand_filesystem="		/* Update filesystem */ \
+		"mtdparts default; " \
+		"nand erase.part filesystem; " \
+		"if test ${ip_dyn} = yes; then " \
+			"setenv get_cmd dhcp; " \
+		"else " \
+			"setenv get_cmd tftp; " \
+		"fi; " \
+		"${get_cmd} ${ubifs_file}; " \
+		"ubi part filesystem; " \
+		"ubi create filesystem; " \
+		"ubi write ${loadaddr} filesystem ${filesize}\0" \
 	"nandargs=setenv bootargs console=${console_mainline},${baudrate} " \
 		"rootfstype=ubifs ubi.mtd=6 root=ubi0_0 ${mtdparts}\0" \
 	"nandboot="		/* Boot from NAND */ \
Signature · 1 line
1.8.4.rc3