cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
derekyu
Visitor
Visitor
5,705 Views
Registered: ‎10-03-2016

How to enable FSBL checksum

Jump to solution

In the bare metal FSBL example code, the partition attribute has a ATTRIBUTE_CHECKSUM_TYPE_MASK to enable image checksum check. However, this bit doesn't get enabled in the standard boot image generated using the SDK.

 

There is also a "checksum=<value>" identifier in the BIF file attributes but it requires manually insert a MD5 checksum

 

How can I enable this bit and is there any way to automatically included the MD5 image checksum in the partition header

0 Kudos
1 Solution

Accepted Solutions
derekyu
Visitor
Visitor
9,700 Views
Registered: ‎10-03-2016

It turns out the documentation is not very clear on this. I simply change the BIF file to add [checksum=md5] like:

 

the_ROM_image:
{
    [bootloader]D:\test\fsbl\Debug\fsbl.elf
    [checksum=md5]D:\test\test_soc_hw_platform_0\test_soc.bit
    [checksum=md5]D:\test\test\Debug\test.elf
}

 

bootgen will automatically set the checksum bit and insert the md5 checksum into the partition header.

View solution in original post

0 Kudos
5 Replies
austin
Scholar
Scholar
5,669 Views
Registered: ‎02-27-2008

d,

 

Which software version?  The frame checksum is only used on a few bytes to recognize the FSBL.  Perhaps what you really need is to use the HMAC?

 

 

Austin Lesea
Principal Engineer
Xilinx San Jose
0 Kudos
derekyu
Visitor
Visitor
5,662 Views
Registered: ‎10-03-2016

I am using SDK 2015.4.

 

In the bare metal FSBL template code generated, the image_mover.c has the code:

/*
* Check for partition checksum check
*/
if (PartitionAttr & ATTRIBUTE_CHECKSUM_TYPE_MASK) {
    PartitionChecksumFlag = 1;
}

 

Once the flag is set, the FSBL will validate the partition image:

 

if (PartitionChecksumFlag) {
    /*
    * Validate the partition data with checksum
    */
    Status = ValidateParition(PartitionStartAddr,
        (PartitionTotalSize << WORD_LENGTH_SHIFT),
        address +
        (PartitionChecksumOffset << WORD_LENGTH_SHIFT));

....

 

I want to know how I can generate an image with ATTRIBUTE_CHECKSUM_TYPE_MASK set.

 

My intention is to validate the image before fallback to use it. I also want to know if there is way to automatically generate the checksum in the build process.

 

 

 

0 Kudos
derekyu
Visitor
Visitor
9,701 Views
Registered: ‎10-03-2016

It turns out the documentation is not very clear on this. I simply change the BIF file to add [checksum=md5] like:

 

the_ROM_image:
{
    [bootloader]D:\test\fsbl\Debug\fsbl.elf
    [checksum=md5]D:\test\test_soc_hw_platform_0\test_soc.bit
    [checksum=md5]D:\test\test\Debug\test.elf
}

 

bootgen will automatically set the checksum bit and insert the md5 checksum into the partition header.

View solution in original post

0 Kudos
wong0977
Visitor
Visitor
1,750 Views
Registered: ‎07-24-2018

Hi, May I know how to proceed on with the setting of Checksum=md5  in terms of providing an error message if the integrity of the .mcs file has been compromised? To further elaborate, I would like to generate a checksum value initially before flashing into QSPI and compare it with the one flashed into the QSPI during QSPI bootup to see if the file has been edited. The image file can be treated in this case as a hello world program. Thank you.

0 Kudos
pvenugo
Moderator
Moderator
1,680 Views
Registered: ‎07-31-2012

Hi @wong0977,

 

The original post is already answered so please create a new post with your query in https://forums.xilinx.com/t5/Embedded-Boot-and-Configuration/bd-p/EmbBoot board to get help.

 

Regards

Praveen


-------------------------------------------------------------------------
Don’t forget to reply, kudo, and accept as solution.
-------------------------------------------------------------------------
0 Kudos