Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

how to use fsbl.bin in HighFive Unleashed board ? #9

Open
atishp04 opened this issue Sep 20, 2018 · 10 comments
Open

how to use fsbl.bin in HighFive Unleashed board ? #9

atishp04 opened this issue Sep 20, 2018 · 10 comments

Comments

@atishp04
Copy link
Contributor

I have made some changes to the device tree and generated the fsbl.bin. How do I update that in Unleashed ?
Chapter 6 in Unleashed starting guide only talks about steps to update complete firmware hifive-unleashed-a00-A.B-YYYY-MM-DD.gpt. This also contains the FSBL, DTB, and recovery kernel.

What is the best procedure to generate the .gpt file ?

@palmer-dabbelt @terpstra @tmagik

@tmagik
Copy link
Contributor

tmagik commented Sep 20, 2018 via email

@atishp04
Copy link
Contributor Author

Thanks for the prompt response @tmagik. How do I find your gptdisk patches ?
I don't see anything in the git log.
https://github.com/sifive/freedom-u540-c000-bootloader/commits/master

@tmagik
Copy link
Contributor

tmagik commented Sep 20, 2018 via email

@atishp04
Copy link
Contributor Author

Thanks. What is the fsbl partition? I see three partitions.

/dev/mtd0 - I think this is the one. But the Unleashed starting guide says use this to flash the complete firmware for spiflash as well.
/dev/mtd0ro
/dev/mtdblock0

@tmagik
Copy link
Contributor

tmagik commented Sep 21, 2018 via email

@atishp04
Copy link
Contributor Author

I am still confused. Apologies for the requesting repeated clarification.

We need to document this a little (or maybe a lot?) better. WIth MSEL2 in the position towards the outside of the board

so it should be 010000 (MSEL 0110000 position is for flash update only?)

, the zsbl will load the fsbl from the SDcard, which in the way I have my development system partitioned is /dev/mmcblk0p4

If I understand correctly, zsbl will load fsbl from /dev/mmcblk0p4?
I will be creating that partition using gdisk. I did not quite understand how zsbl will know to load the fsbl from that. I thought it will load from mtdblock0 or something. Can you please clarify little more on this ?

cat /proc/partitions
major minor #blocks name
31 0 32768 mtdblock0
259 0 250059096 nvme0n1
179 0 7761920 mmcblk0 179
1 20480 mmcblk0p1
179 2 7629807 mmcblk0p2
179 4 1024 mmcblk0p4
So if you can get a pretty nice flow for FSBL development (that involves manually swapping SDcards, for now) by putting it on a small partition. The ‘.gpt’ data that goes into the flash is basically just a disk image with a GPT partition map that would also work if written to an SDcard. There is scripting and documentation that needs to be worked out better after we have u-boot running, which is what I’m trying to get done now.

Thanks for the details.


On Sep 20, 2018, at 8:34 PM, Atish Patra @.***> wrote: Thanks. What is the fsbl partition? I see three partitions. /dev/mtd0 - I think this is the one. But the Unleashed starting guide says use this to flash the complete firmware for spiflash as well. /dev/mtd0ro /dev/mtdblock0 — You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub, or mute the thread.

Here are the all steps as per my understanding

  • Compile fsbl from the repo. It should generate fsbl.bin
  • create a partition in sdcard using gdisk (your repo). Something like /dev/mmcblk0px
  • copy the fsbl.bin to /dev/mmcblk0px
  • MSEL2 position towards the outside of the board
  • Reboot and zsbl will load the fsbl from /dev/mmcblk0px or mtdblock0??

@jim-wilson
Copy link
Contributor

jim-wilson commented Sep 21, 2018 via email

@tmagik
Copy link
Contributor

tmagik commented Sep 21, 2018 via email

@atishp04
Copy link
Contributor Author

atishp04 commented Sep 21, 2018

Ahh. Now it makes sense. Thanks @tmagik @jim-wilson

I tried as per discussed above.

However I couldn't boot into unleashed board.
Just got this error.
0x1000000000002
Here is my disk partition details
$ sudo ./gdisk /dev/sda
GPT fdisk (gdisk) version 1.0.4

Partition table scan:
MBR: protective
BSD: not present
APM: not present
GPT: present

Found valid GPT with protective MBR; using GPT.

Command (? for help): i
Partition number (1-3): 3
Partition GUID code: 5B193300-FC78-40CD-8002-E86C45580B47 (SiFive FSBL (first-stage bootloader))
Partition unique GUID: 39A6BAC7-3AE9-4797-A9E8-10692801C0C7
First sector: 198656 (at 97.0 MiB)
Last sector: 264191 (at 129.0 MiB)
Partition size: 65536 sectors (32.0 MiB)
Attribute flags: 0000000000000000
Partition name: 'SiFive FSBL (first-stage bootloader)'

I verified the partition3 by dumping to a text file. It looks like a have a correct fsbl.

@atishp04
Copy link
Contributor Author

ok. I got it working. Thanks @tmagik

Here are the steps in case anybody is also trying to do the same.

  1. Compile fsbl from the repo. It should generate fsbl.bin
  2. create a partition in sdcard using gdisk (your repo). Something like /dev/disk2s4

Here is my partition table. The new partition should be of SiFive FSBL (type 5201)

Number
Start (sector) End (sector) Size Code Name
1 2048 67583 32.0 MiB 5202 bootloader
2 264192 15523806 7.3 GiB 8300
4 67584 67839 128.0 KiB 5201 SiFive FSBL (first-...
Command (? for help): i
Partition number (1-4): 4
Partition GUID code: 5B193300-FC78-40CD-8002-E86C45580B47 (SiFive FSBL (first-stage bootloader))
Partition unique GUID: 9076BB97-68EA-4899-8FC9-72FEFF4F435C
First sector: 67584 (at 33.0 MiB)
Last sector: 67839 (at 33.1 MiB)
Partition size: 256 sectors (128.0 KiB)
Attribute flags: 0000000000000000
Partition name: 'SiFive FSBL (first-stage bootloader)'

  1. copy the fsbl.bin to /dev/disk2s4

sudo dd if=/tmp/fsbl.bin of=/dev/disk2s4

  1. MSEL2 position towards the outside of the board
  2. Reboot and zsbl will load the fsbl from /dev/disk2s4.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants