Open atishp04 opened 6 years ago
Start with my gptfdisk patches and create a partition on the sdcard and flip the right switch, that way you can test by just DDing fsbl.bin to the fsbl partition without having to deal with the spi flash write commands
On Thu, Sep 20, 2018, 1:13 PM Atish Patra notifications@github.com wrote:
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 https://github.com/palmer-dabbelt @terpstra https://github.com/terpstra @tmagik https://github.com/tmagik
— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/sifive/freedom-u540-c000-bootloader/issues/9, or mute the thread https://github.com/notifications/unsubscribe-auth/AGAQEN6pHRUjoI9WXOWRHbiyhqnv2I_lks5uc9rggaJpZM4WyqOQ .
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
https://github.com/tmagik/gptfdisk
On Thu, Sep 20, 2018, 1:30 PM Atish Patra notifications@github.com wrote:
Thanks for the prompt response @tmagik https://github.com/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
— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/sifive/freedom-u540-c000-bootloader/issues/9#issuecomment-423286838, or mute the thread https://github.com/notifications/unsubscribe-auth/AGAQEMlTTQc1-N6NYKSpiwLfZIUOgahtks5uc966gaJpZM4WyqOQ .
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
We need to document this a little (or maybe a lot?) better.
WIth MSEL2 in the position towards the outside of the board, the zsbl will load the fsbl from the SDcard, which in the way I have my development system partitioned is /dev/mmcblk0p4
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.
On Sep 20, 2018, at 8:34 PM, Atish Patra notifications@github.com 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.
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
On Fri, Sep 21, 2018 at 12:06 PM Atish Patra notifications@github.com wrote:
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 ?
It looks at the partition codes.
https://github.com/tmagik/gptfdisk/commit/27f5602d98225931c62d014136a5be7559dc1293 You can also find the partition codes in the freedom-u-sdk Makefile.
I haven't done this myself though. It really needs better documentation somewhere.
Jim
FSBL and ZSBL share the same code, which understands GPT partitions:
https://github.com/sifive/freedom-u540-c000-bootloader/blob/master/ux00boot/ux00boot.c#L24
to summarize the ones we (probably) care about:
On Sep 21, 2018, at 2:38 PM, Jim Wilson notifications@github.com wrote:
On Fri, Sep 21, 2018 at 12:06 PM Atish Patra notifications@github.com wrote:
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 ?
It looks at the partition codes.
https://github.com/tmagik/gptfdisk/commit/27f5602d98225931c62d014136a5be7559dc1293 You can also find the partition codes in the freedom-u-sdk Makefile.
I haven't done this myself though. It really needs better documentation somewhere.
Jim — You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub, or mute the thread.
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.
ok. I got it working. Thanks @tmagik
Here are the steps in case anybody is also trying to do the same.
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)'
sudo dd if=/tmp/fsbl.bin of=/dev/disk2s4
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