Skip to contentSkip to conversation

Ensuring correctness of U-boot in the flash

U-Boot-Users David Saada 3 participants 10 messages Sep 16, 2007 – Sep 20, 2007

lore
Share & tools
lore
#0 lore raw

Hello,
Is there a way to ensure the correctness of U-boot in the flash (e.g. CRC)? This is mainly needed for U-boot field upgrades and flash BIT. Regards,
David.

Signature · 2 lines
View this message in context: http://www.nabble.com/Ensuring-correctness-of-U-boot-in-the-flash-tf4450434.html#a12697552
Sent from the Uboot - Users mailing list archive at Nabble.com.
#1 lore raw
Quoted 1 line · David Saada

Is there a way to ensure the correctness of U-boot in the flash (e.g. CRC)?

assuming it isnt memory mapped, read it into ram and use the crc command ? if it is memory mapped, then just use the crc command ...
-mike
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 827 bytes
Desc: This is a digitally signed message part.
Url : http://lists.denx.de/pipermail/u-boot/attachments/20070916/613659de/attachment.pgp

#2 lore raw
Quoted 2 lines
Quoted 2 lines

Is there a way to ensure the correctness of U-boot in the flash (e.g.

CRC)?

Quoted 3 lines

assuming it isnt memory mapped, read it into ram and use the crc command ? if
it is memory mapped, then just use the crc command ...

Yes of course I can do that. My question was if there was a way (or a plan) to embed this CRC in the U-boot image, otherwise I'd have to burn it elsewhere (in another sector for instance).

David.

Signature · 2 lines
View this message in context: http://www.nabble.com/Ensuring-correctness-of-U-boot-in-the-flash-tf4450434.html#a12698794
Sent from the Uboot - Users mailing list archive at Nabble.com.
#9 lore raw
In reply to David Saada
Quoted 3 lines · In message <[email protected]> you wrote:

Is there a way to ensure the correctness of U-boot in the flash (e.g. CRC)? This is mainly needed for U-boot field upgrades and flash BIT.

Yes, there is. You do this manually (i. e. by using for example the "crc" command), or you can even enable MD5 checksum verification.

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
"Remember, Information is not knowledge;  Knowledge  is  not  Wisdom;
Wisdom is not truth; Truth is not beauty; Beauty is not love; Love is
not music; Music is the best."                          - Frank Zappa
#3 lore raw
In reply to David Saada
Quoted 4 lines · In message <[email protected]> you wrote:

Yes of course I can do that. My question was if there was a way (or a plan) to embed this CRC in the U-boot image, otherwise I'd have to burn it elsewhere (in another sector for instance).

The environment is a convenient place, unless your environment is embedded within U-Boot, in which case you need to split this up anyway.

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
I'm a programmer: I don't buy software, I write it.
                                                  -- Tom Christiansen
#4 lore raw
Quoted 2 lines
Quoted 2 lines

Yes of course I can do that. My question was if there was a way (or a

plan)

Quoted 6 lines
Quoted 2 lines

to embed this CRC in the U-boot image, otherwise I'd have to burn it elsewhere (in another sector for instance).

The environment is a convenient place, unless your environment is embedded within U-Boot, in which case you need to split this up anyway.

Won't work in our case I'm afraid. First, we would like the booted application to be able to check the CRC after upgrading U-boot, which means that it will need to know the environment structure (something that is also problematic legally, as some of our applications are non GPL). Second, our master plan is to have two copies of U-boot programmed on the flash (for field upgrades sake), with a mutual environment sector.
I guess the only way to implement this meeting our requirements is to sacrifice an adjacent sector that will only hold the CRC.
Best regards,
David.

Signature · 2 lines
View this message in context: http://www.nabble.com/Ensuring-correctness-of-U-boot-in-the-flash-tf4450434.html#a12751790
Sent from the Uboot - Users mailing list archive at Nabble.com.
#5 lore raw
Quoted 9 lines · In message <[email protected]> you wrote:
Quoted 4 lines

The environment is a convenient place, unless your environment is embedded within U-Boot, in which case you need to split this up anyway.

Won't work in our case I'm afraid. First, we would like the booted application to be able to check the CRC after upgrading U-boot, which means that it will need to know the environment structure (something that is also problematic legally, as some of our applications are non GPL). Second, our

I don't understand why this should be a problem. Reading the environment can be done by separate tools lile fw_printenv (see tools/env/).

Quoted 2 lines

master plan is to have two copies of U-boot programmed on the flash (for field upgrades sake), with a mutual environment sector.

So you have some primary bootstrap loader which performs the selection and switching? Well, sounds overly complicated to me, but it's your choice.

Quoted 2 lines

I guess the only way to implement this meeting our requirements is to sacrifice an adjacent sector that will only hold the CRC.

Why don't you enable the MD5 checksum feature then? It uses an embedded (in the image) MD5 checksum.

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
To know how another being, another creature feels -  that  is  impos-
sible.                  - Terry Pratchett, _The Dark Side of the Sun_
#6 lore raw
Quoted 3 lines

I don't understand why this should be a problem. Reading the environment can be done by separate tools lile fw_printenv (see tools/env/).

Can I use it in non-GPL apps as well? Anyway as I mentioned before, storing the CRC in the environment isn't suitable for us anyway.

Quoted 3 lines

So you have some primary bootstrap loader which performs the selection and switching? Well, sounds overly complicated to me, but it's your choice.

This is one option, but I don't like it because it's cumbersome indeed. This is actually the implementation in our older (non U-boot) boards. Another option we consider is to have two initially identical copies of U-boot in the flash, say U-boot1 & U-boot2, where U-boot1 is considered to be the non upgradeable boot, and U-boot2 is the upgradeable one. At an early stage of U-boot1 (say board_init_f), it checks the CRC of U-boot2, and if ok, it branches there (otherwise it continues as usual). This way, in most of the cases U-boot2 is the "active" booter, and U-boot1 is only used for failsafe purposes. It's just an idea at this stage though.

Quoted 2 lines

Why don't you enable the MD5 checksum feature then? It uses an embedded (in the image) MD5 checksum.

Sorry - searched throughout the code and documentation, and couldn't find anything on MD5 checksum. Would appreciate more details.

Regards,
David.

#7 lore raw
Quoted 3 lines · In message <[email protected]> you…

Sorry - searched throughout the code and documentation, and couldn't find anything on MD5 checksum. Would appreciate more details.

You couldn't find it, because I confused that ;-)

It's a SHA1 checksun what's being used. See doc/README.sha1

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
Prepare for tomorrow -- get ready.
	-- Edith Keeler, "The City On the Edge of Forever",
	   stardate unknown