[PATCH v2] beagleboard-test-scripts: Add a script flash-fs.sh for flashing NAND

41 views
Skip to first unread message

Joel A Fernandes

unread,
Jul 6, 2011, 12:15:19 PM7/6/11
to openembed...@lists.openembedded.org, Joel A Fernandes, j...@ti.com, k-k...@ti.com, chase....@ti.com, joel...@ti.com, bea...@list.ti.com, beagl...@googlegroups.com
This script flashes the NAND of a BeagleBoard if it exists, and if there is a valid image to flash

Signed-off-by: Joel A Fernandes <agnel...@gmail.com>
---
Changes since v1:
* Bumped PR
* Using commit revision number instead of AUTOREV
* Using update-rc.d class instead of copying init script to /etc/rc5.d/
* Removed full stops from the commit summary
* Made comment on the init script in do_install more clear

.../beagleboard/beagleboard-test-scripts_git.bb | 14 +++++++++++---
1 files changed, 11 insertions(+), 3 deletions(-)

diff --git a/recipes/beagleboard/beagleboard-test-scripts_git.bb b/recipes/beagleboard/beagleboard-test-scripts_git.bb
index be0d059..4e0f54f 100644
--- a/recipes/beagleboard/beagleboard-test-scripts_git.bb
+++ b/recipes/beagleboard/beagleboard-test-scripts_git.bb
@@ -1,14 +1,18 @@
## Reminder: The correct spacing for a variable is FOO = "BAR" in : PR="r1"
DESCRIPTION = "BeagleBoard test scripts"
HOMEPAGE = "http://beagleboad.org/support"
-PR = "r2"
+PR = "r3"

-SRC_URI = "git://gitorious.org/beagleboard-validation/scripts.git;protocol=git \
+SRC_URI = "git://gitorious.org/~joelf/beagleboard-validation/validation-scripts.git;protocol=git \
"

-SRCREV = "473dd2ab20d866be6168c9f992c2c9e74e485c9d"
+SRCREV = "c482b7cb6caaa986a86d360d39e9040c77667d6b"
S = "${WORKDIR}/git"

+inherit update-rc.d
+INITSCRIPT_NAME = "flash-fs.sh"
+INITSCRIPT_PARAMS = "start 99 2 3 4 5 ."
+
do_install() {
TEST_FILES=" \
testaudio \
@@ -28,4 +32,8 @@ do_install() {
for i in ${TEST_FILES}; do
install -m 0755 ${S}/${i} ${D}/${bindir}
done
+ # A script to flash NAND if the board has it, and if there is valid image to flash on the SD Card.
+ # We also register it as an init script so that the SD Card auto-flashes to NAND during boot.
+ install -d ${D}/${sysconfdir}/init.d/
+ install -m 0755 ${S}/flashing/flash-fs.sh ${D}/${sysconfdir}/init.d/flash-fs.sh
}
--
1.7.0.4

Jason Kridner

unread,
Jul 7, 2011, 10:35:18 AM7/7/11
to openembed...@lists.openembedded.org, joel...@ti.com, beagl...@googlegroups.com, k-k...@ti.com, Joel A Fernandes, j...@ti.com
On Wed, Jul 6, 2011 at 12:15 PM, Joel A Fernandes <agnel...@gmail.com> wrote:
> This script flashes the NAND of a BeagleBoard if it exists, and if there is a valid image to flash
>
> Signed-off-by: Joel A Fernandes <agnel...@gmail.com>

Acked-by: Jason Kridner <jkri...@beagleboard.org>

I will eventually merge your changes into the mainline, but I believe
it is helpful to get these updates in OE for BeagleBoard users who
want to reproduce the shipping images.

Can you update the process to only flash the boards if the USER button
is held or some other similar strategy? It seems that enabling this
script would make the SD card image useless for non-flashing
activities. Of course, Gerald would need to sign-off on any flashing
process changes.

> _______________________________________________
> Openembedded-devel mailing list
> Openembed...@lists.openembedded.org
> http://lists.linuxtogo.org/cgi-bin/mailman/listinfo/openembedded-devel
>

Joel A Fernandes

unread,
Jul 7, 2011, 10:49:58 AM7/7/11
to Jason Kridner, openembed...@lists.openembedded.org, joel...@ti.com, beagl...@googlegroups.com, k-k...@ti.com, j...@ti.com
On Thu, Jul 7, 2011 at 9:35 AM, Jason Kridner <jkri...@beagleboard.org> wrote:
> On Wed, Jul 6, 2011 at 12:15 PM, Joel A Fernandes <agnel...@gmail.com> wrote:
>> This script flashes the NAND of a BeagleBoard if it exists, and if there is a valid image to flash
>>
>> Signed-off-by: Joel A Fernandes <agnel...@gmail.com>
>
> Acked-by: Jason Kridner <jkri...@beagleboard.org>
>
> I will eventually merge your changes into the mainline, but I believe
> it is helpful to get these updates in OE for BeagleBoard users who
> want to reproduce the shipping images.
>

> Can you update the process to only flash the boards if the USER button
> is held or some other similar strategy?  It seems that enabling this
> script would make the SD card image useless for non-flashing

Since we cannot access user-button as its used as an input event, can
I put in a message like "Press any key to flash", timeout if no key is
hit and then normally boot?

Regards
Joel

Joel A Fernandes

unread,
Jul 7, 2011, 10:52:19 AM7/7/11
to Kooi, Koen, Jason Kridner, openembed...@lists.openembedded.org, Fernandes, Joel A, beagl...@googlegroups.com, Kridner, Jason
On Thu, Jul 7, 2011 at 9:37 AM, Kooi, Koen <k-k...@ti.com> wrote:
> Since we're not in a ramdisk anymore, we could also dump a /etc/joel-was-here file to see if we already have flashed nand from this specific card or not.
>
>

Don't see how this will work when the same card is used to flash
multiple boards?

Regards,
Joel

Jason Kridner

unread,
Jul 7, 2011, 10:52:34 AM7/7/11
to Kooi, Koen, openembed...@lists.openembedded.org, Fernandes, Joel A, beagl...@googlegroups.com, Joel A Fernandes, Kridner, Jason
On Thu, Jul 7, 2011 at 10:37 AM, Kooi, Koen <k-k...@ti.com> wrote:
> Since we're not in a ramdisk anymore, we could also dump a /etc/joel-was-here file to see if we already have flashed nand from this specific card or not.

That would indeed make the card more useful, but it seems to be tied
to the wrong state--especially in a production environment where you
likely want to reuse the card on multiple boards.

It is critical that the public has a card image they can download to
restore the flash into its factory condition. For C5 boards, it seems
to me that the USER button is a reasonable approach as it will cause
the on-card x-loader to be used that will give preference to the
on-card u-boot. The remaining challenge is the lack of an isolated
command to read the environment from the NAND flash. The current
u-boot will always have the default environment overridden by the
environment in NAND flash.

We discussed previously on this list the idea of adding a command to
read the environment from the NAND flash and then adjusting the
default environment to perform that read and use the on-NAND
environment (as priority above any other environment settings, such as
uenv.txt on the SD card) if the USER button was not pressed. Then,
the reading of the environment from the NAND flash could be removed
and only read as part of the default environment settings.

A C5 image needs to go out, so I'm OK adding none of these changes for
this release, but I'd like it if Joel could make the above NAND/USER
button related changes to the mainline u-boot as part of the effort to
get all of the BeagleBoard u-boot patches into mainline. At that
point, a new flashing image could be released. In the meantime,
manual intervention of 'nand erase 260000 2000' may be required to
initiate flashing boards that have been modified.

>
>
> Texas Instruments Limited, 800 Pavilion Drive, Northampton, NN4 7YL. Registered in England & Wales under company number 00574102
>
> -----Original Message-----

Jason Kridner

unread,
Jul 7, 2011, 11:12:04 AM7/7/11
to Joel A Fernandes, openembed...@lists.openembedded.org, joel...@ti.com, beagl...@googlegroups.com, k-k...@ti.com, j...@ti.com

You should be able to check the status similar to the way you do for
keyboards. From what I've read[1][2], you can simply use the
EVIOCGKEY ioctl to check the state.

[1] http://andrey.thedotcommune.com/2010/02/heres-another-quick-linux-input-snippet.html
[2] http://www.linuxjournal.com/node/6429/print

>
> Regards
> Joel
>

Kooi, Koen

unread,
Jul 7, 2011, 10:37:49 AM7/7/11
to Jason Kridner, openembed...@lists.openembedded.org, Fernandes, Joel A, beagl...@googlegroups.com, Joel A Fernandes, Kridner, Jason
Since we're not in a ramdisk anymore, we could also dump a /etc/joel-was-here file to see if we already have flashed nand from this specific card or not.

Texas Instruments Limited, 800 Pavilion Drive, Northampton, NN4 7YL. Registered in England & Wales under company number 00574102

-----Original Message-----

From: Jason Kridner [mailto:jkri...@beagleboard.org]
Sent: Thursday, July 07, 2011 4:35 PM
To: openembed...@lists.openembedded.org
Cc: Fernandes, Joel A; beagl...@googlegroups.com; Kooi, Koen; Joel A Fernandes; Kridner, Jason
Subject: Re: [oe] [PATCH v2] beagleboard-test-scripts: Add a script flash-fs.sh for flashing NAND

Mark

unread,
Jul 7, 2011, 12:36:33 PM7/7/11
to Beagle Board
I just spent a fair amount of time working with the different
versions and variations of u-boot that have evolved. It seems that
perhaps there is some confusion over the boot procedure and the
userbutton. These differences in the u-boot versions are being signed-
off/approved. I can see from reading Jason's post why there are
problems being introduced. It is very subtle, but the difference is
vast.


> restore the flash into its factory condition. For C5 boards, it seems
> to me that the USER button is a reasonable approach as it will cause
> the on-card x-loader to be used that will give preference to the
> on-card u-boot. The remaining challenge is the lack of an isolated


The ROM bootloader searches for Xloader in the following order:

User button not pressed (SYS.BOOT[5] = 0): NAND -> USB -> UART3 ->
MMC1
User button is pressed (SYS.BOOT[5] = 1): USB -> UART3 -> MMC1 ->
NAND


Xloader then searches for u-boot.bin on the FAT32 partion of SD/MMC.
If not found it will then look in NAND.


After U-boot loads it reads the bootcmd variable in the NAND
environment is executed. This can lead to the following problems:

1) Newer versions of u-boot do not recognize mmc init or they may
require mmc init ${mmcdev}.
2) Since there is not a userbutton command in the newer versions, the
old method of calling user.scr instead of boot.scr is defunct.


I have a working setup of Angstrom in NAND on a revC4 board. If I
have a SD card in the slot it will boot from the u-boot and uImage in
ext3 partiton from the SD. I have this setup working for a Ubuntu
card (one that loads a ramdisk from the FAT32 partition) too.

This setup will not work with just any version of u-boot.


The card that I have for flashing NAND only works if the user button
is pressed. It is the same NAND image that koen posted here:

http://www.google.com/url?sa=D&q=http://groups.google.com/group/beagleboard/browse_thread/thread/ce2fb5fe7532c1a3/7ffd264fa5634d07%3Fq%23




--Mark

Jason Kridner

unread,
Jul 7, 2011, 12:58:01 PM7/7/11
to beagl...@googlegroups.com

So what is your recommended design approach? Do you agree with my
assertion that the reading of the NAND environment should be moved
into a command executed (optionally) by the default environment
(compiled-in environment that might test the USER button, rather than
the compiled-in option that always reads the environment from NAND)?

Joel A Fernandes

unread,
Jul 7, 2011, 1:14:45 PM7/7/11
to beagl...@googlegroups.com
Hi Jason,

> So what is your recommended design approach?  Do you agree with my
> assertion that the reading of the NAND environment should be moved
> into a command executed (optionally) by the default environment
> (compiled-in environment that might test the USER button, rather than
> the compiled-in option that always reads the environment from NAND)?

I agree this and will work on it.

On a separate note, for now, I will like to check the user button
anyway in U-boot (once uEnv.txt takes precedence after a NAND erase of
the environment) to determine if we should flash U-boot and Uimage, or
instead, boot directly from NAND if the user button is not pressed.

Are you ok with this? Thanks,
Joel

Jason Kridner

unread,
Jul 7, 2011, 1:26:59 PM7/7/11
to beagl...@googlegroups.com

I believe the prevailing opinion is that 2 card images are necessary:
1 for flashing boards that have flash (ie. BeagleBoard rev Bx/Cx
boards) and 1 for executing boards without flash (ie. xM rev A/B/C
boards). Despite this, I think it is still a stretch goal to try to
have one SD card image that can be shipped with BeagleBoard-xMs and be
used to flash BeagleBoards. I'd like to see as little documentation
required as possible on how to use that SD card image. The more that
can be done to reduce the permutations, the better, in my opinion. I
think what you are talking about is a difference in the default
environment and I'm not supportive of that. Having different
uenv.txt/user.txt files is something for which I'd be more supportive,
if they were necessary for initiating the flashing.

Mark

unread,
Jul 7, 2011, 1:27:08 PM7/7/11
to Beagle Board
Never break what you are standing on. I would leave the default to
read the NAND environment alone. That decision was made long ago.

The only thing that needs to be common among all of the u-boot
versions is the ability to recognize the same bootcmd arguments. Old
functions should not be removed. If you do, at least leave the stub
or redirect the call.

Xloader will always read the uboot from SD card in preference to the
one in NAND. This u-boot can be much different than the one used to
load the NAND rootfs, *** as long as it can read the bootcmd args ***
and execute the conditional statements properly.


--Mark


Joel A Fernandes

unread,
Jul 7, 2011, 1:37:46 PM7/7/11
to beagl...@googlegroups.com

Hi Jason,

Sorry I am afraid I'm not very clear about it.

Are you saying you're against something like this in uEnv.txt that
will go into the final image?

uenvcmd=if userbutton; then run nandflash; else run nandboot; fi

nandflash would write uImage and u-boot to NAND partitions, and then do a boot
nandboot would expect everything to be already there.

thanks,
Joel

Joel A Fernandes

unread,
Jul 7, 2011, 5:23:56 PM7/7/11
to openembed...@lists.openembedded.org, Joel A Fernandes, j...@ti.com, k-k...@ti.com, joel...@ti.com, beagl...@googlegroups.com
This script flashes the NAND of a BeagleBoard if:
* The user-button is pressed
* There is a valid image on the SD Card to flash
* The board has NAND

Signed-off-by: Joel A Fernandes <agnel...@gmail.com>

---
Changes since v2:
User button is checked before flashing of the board

This is based on Jason's review:
http://groups.google.com/group/beagleboard/msg/835de9a37c3a340a

.../beagleboard/beagleboard-test-scripts_git.bb | 14 +++++++++++---
1 files changed, 11 insertions(+), 3 deletions(-)

diff --git a/recipes/beagleboard/beagleboard-test-scripts_git.bb b/recipes/beagleboard/beagleboard-test-scripts_git.bb
index be0d059..3f3cc56 100644


--- a/recipes/beagleboard/beagleboard-test-scripts_git.bb
+++ b/recipes/beagleboard/beagleboard-test-scripts_git.bb
@@ -1,14 +1,18 @@
## Reminder: The correct spacing for a variable is FOO = "BAR" in : PR="r1"
DESCRIPTION = "BeagleBoard test scripts"
HOMEPAGE = "http://beagleboad.org/support"
-PR = "r2"
+PR = "r3"

-SRC_URI = "git://gitorious.org/beagleboard-validation/scripts.git;protocol=git \
+SRC_URI = "git://gitorious.org/~joelf/beagleboard-validation/validation-scripts.git;protocol=git \
"

-SRCREV = "473dd2ab20d866be6168c9f992c2c9e74e485c9d"

+SRCREV = "513bfa2e99822150ea5845f3a33c349029cb7c13"

Jason Kridner

unread,
Jul 7, 2011, 8:32:42 PM7/7/11
to beagl...@googlegroups.com, openembed...@lists.openembedded.org, Joel A Fernandes, j...@ti.com, k-k...@ti.com, joel...@ti.com
On Thu, Jul 7, 2011 at 5:23 PM, Joel A Fernandes <agnel...@gmail.com> wrote:
> This script flashes the NAND of a BeagleBoard if:
>  * The user-button is pressed
>  * There is a valid image on the SD Card to flash
>  * The board has NAND
>
> Signed-off-by: Joel A Fernandes <agnel...@gmail.com>

Acked-by: Jason Kridner <jkri...@beagleboard.org>

> ---
> Changes since v2:
>  User button is checked before flashing of the board
>
> This is based on Jason's review:
> http://groups.google.com/group/beagleboard/msg/835de9a37c3a340a
>
>  .../beagleboard/beagleboard-test-scripts_git.bb    |   14 +++++++++++---
>  1 files changed, 11 insertions(+), 3 deletions(-)
>
> diff --git a/recipes/beagleboard/beagleboard-test-scripts_git.bb b/recipes/beagleboard/beagleboard-test-scripts_git.bb
> index be0d059..3f3cc56 100644
> --- a/recipes/beagleboard/beagleboard-test-scripts_git.bb
> +++ b/recipes/beagleboard/beagleboard-test-scripts_git.bb
> @@ -1,14 +1,18 @@
>  ## Reminder:  The correct spacing for a variable is FOO = "BAR"  in : PR="r1"
>  DESCRIPTION = "BeagleBoard test scripts"
>  HOMEPAGE = "http://beagleboad.org/support"
> -PR = "r2"
> +PR = "r3"
>
> -SRC_URI = "git://gitorious.org/beagleboard-validation/scripts.git;protocol=git \
> +SRC_URI = "git://gitorious.org/~joelf/beagleboard-validation/validation-scripts.git;protocol=git \
>  "
>
> -SRCREV = "473dd2ab20d866be6168c9f992c2c9e74e485c9d"
> +SRCREV = "513bfa2e99822150ea5845f3a33c349029cb7c13"

Thanks!

Khem Raj

unread,
Jul 7, 2011, 8:47:10 PM7/7/11
to openembed...@lists.openembedded.org, beagl...@googlegroups.com, joel...@ti.com, k-k...@ti.com, Joel A Fernandes, openembed...@lists.openembedded.org, j...@ti.com

Would it be better to call it flash-nand-fs.sh ? Or have NAND somewhere in it's name

Joel A Fernandes

unread,
Jul 8, 2011, 12:22:42 AM7/8/11
to openembed...@lists.openembedded.org, Joel A Fernandes, j...@ti.com, k-k...@ti.com, joel...@ti.com, beagl...@googlegroups.com, g-co...@ti.com
This script flashes the NAND of a BeagleBoard if:
* There is a valid image on the SD Card to flash
* The board has NAND

Signed-off-by: Joel A Fernandes <agnel...@gmail.com>

---
Changes since v3:
* User button changes for flashing have been removed as it seemed unstable and we would like to have a
revision which we're using for the BeagleBoard image that's being shipped with a BeagleBoard C5 board.

We're calling this version of the build "Alpha", the "Beta" will have the flash-with-userbutton feature

* flash-fs.sh renamed to to flash-nand-fs.sh after suggestion from Khem

.../beagleboard/beagleboard-test-scripts_git.bb | 14 +++++++++++---
1 files changed, 11 insertions(+), 3 deletions(-)

diff --git a/recipes/beagleboard/beagleboard-test-scripts_git.bb b/recipes/beagleboard/beagleboard-test-scripts_git.bb
index be0d059..0ee7954 100644


--- a/recipes/beagleboard/beagleboard-test-scripts_git.bb
+++ b/recipes/beagleboard/beagleboard-test-scripts_git.bb
@@ -1,14 +1,18 @@
## Reminder: The correct spacing for a variable is FOO = "BAR" in : PR="r1"
DESCRIPTION = "BeagleBoard test scripts"
HOMEPAGE = "http://beagleboad.org/support"
-PR = "r2"
+PR = "r3"

-SRC_URI = "git://gitorious.org/beagleboard-validation/scripts.git;protocol=git \
+SRC_URI = "git://gitorious.org/~joelf/beagleboard-validation/validation-scripts.git;protocol=git \
"

-SRCREV = "473dd2ab20d866be6168c9f992c2c9e74e485c9d"

+SRCREV = "2df76857155fbd462527c2b00ee83214483f0594"


S = "${WORKDIR}/git"

+inherit update-rc.d

+INITSCRIPT_NAME = "flash-nand-fs.sh"


+INITSCRIPT_PARAMS = "start 99 2 3 4 5 ."
+
do_install() {
TEST_FILES=" \
testaudio \
@@ -28,4 +32,8 @@ do_install() {
for i in ${TEST_FILES}; do
install -m 0755 ${S}/${i} ${D}/${bindir}
done
+ # A script to flash NAND if the board has it, and if there is valid image to flash on the SD Card.
+ # We also register it as an init script so that the SD Card auto-flashes to NAND during boot.
+ install -d ${D}/${sysconfdir}/init.d/

+ install -m 0755 ${S}/flashing/flash-nand-fs.sh ${D}/${sysconfdir}/init.d/flash-nand-fs.sh
}
--
1.7.0.4

Jason Kridner

unread,
Jul 8, 2011, 1:24:54 AM7/8/11
to beagl...@googlegroups.com
On Fri, Jul 8, 2011 at 12:22 AM, Joel A Fernandes <agnel...@gmail.com> wrote:
> This script flashes the NAND of a BeagleBoard if:
>  * There is a valid image on the SD Card to flash
>  * The board has NAND
>
> Signed-off-by: Joel A Fernandes <agnel...@gmail.com>

For what it is worth:

Acked-by: Jason Kridner <jkri...@beagleboard.org>

> --
> You received this message because you are subscribed to the Google Groups "Beagle Board" group.
> To post to this group, send email to beagl...@googlegroups.com.
> To unsubscribe from this group, send email to beagleboard...@googlegroups.com.
> For more options, visit this group at http://groups.google.com/group/beagleboard?hl=en.
>
>

Reply all
Reply to author
Forward
0 new messages