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

login
register
mail settings
Submitter Joel A Fernandes
Date July 6, 2011, 4:15 p.m.
Message ID <1309968919-23810-1-git-send-email-agnel.joel@gmail.com>
Download mbox | patch
Permalink /patch/7093/
State New, archived
Headers show

Comments

Joel A Fernandes - July 6, 2011, 4:15 p.m.
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.joel@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(-)
Jason Kridner - July 7, 2011, 2:35 p.m.
On Wed, Jul 6, 2011 at 12:15 PM, Joel A Fernandes <agnel.joel@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.joel@gmail.com>

Acked-by: Jason Kridner <jkridner@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.

> ---
> 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
>
>
> _______________________________________________
> Openembedded-devel mailing list
> Openembedded-devel@lists.openembedded.org
> http://lists.linuxtogo.org/cgi-bin/mailman/listinfo/openembedded-devel
>
Joel A Fernandes - July 7, 2011, 2:49 p.m.
On Thu, Jul 7, 2011 at 9:35 AM, Jason Kridner <jkridner@beagleboard.org> wrote:
> On Wed, Jul 6, 2011 at 12:15 PM, Joel A Fernandes <agnel.joel@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.joel@gmail.com>
>
> Acked-by: Jason Kridner <jkridner@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 - July 7, 2011, 2:52 p.m.
On Thu, Jul 7, 2011 at 9:37 AM, Kooi, Koen <k-kooi@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 - July 7, 2011, 2:52 p.m.
On Thu, Jul 7, 2011 at 10:37 AM, Kooi, Koen <k-kooi@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-----
>
> From: Jason Kridner [mailto:jkridner@beagleboard.org]
> Sent: Thursday, July 07, 2011 4:35 PM
> To: openembedded-devel@lists.openembedded.org
> Cc: Fernandes, Joel A; beagleboard@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
>
> On Wed, Jul 6, 2011 at 12:15 PM, Joel A Fernandes <agnel.joel@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.joel@gmail.com>
>
> Acked-by: Jason Kridner <jkridner@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.
>
>> ---
>> 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
>>
>>
>> _______________________________________________
>> Openembedded-devel mailing list
>> Openembedded-devel@lists.openembedded.org
>> http://lists.linuxtogo.org/cgi-bin/mailman/listinfo/openembedded-devel
>>
>
>
Jason Kridner - July 7, 2011, 3:12 p.m.
On Thu, Jul 7, 2011 at 10:49 AM, Joel A Fernandes <agnel.joel@gmail.com> wrote:
> On Thu, Jul 7, 2011 at 9:35 AM, Jason Kridner <jkridner@beagleboard.org> wrote:
>> On Wed, Jul 6, 2011 at 12:15 PM, Joel A Fernandes <agnel.joel@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.joel@gmail.com>
>>
>> Acked-by: Jason Kridner <jkridner@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?

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
>

Patch

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
 }