[lowrisc-dev] Linux booting help

Francesco Viggiano francesco.vgg at gmail.com
Sat Jun 4 08:51:24 BST 2016


So,  everything that happens after the "eret"  is due to vmlinux running,
am I right? I see that it manages to open the root.bin file,  then nothing
else so far. I keep digging into the code..

Francesco

On Fri, Jun 3, 2016, 18:03 Wei Song <ws327 at cam.ac.uk> wrote:

> Hello Francesco,
>
> Glad to know you managed to load the vmlinux.
> The load_elf() in bbl loads vmlinux to virtual memory space rather than
> physical memory space.
> So the actual address depends on the virtual address in vmlinux and the
> page table initialize by vm.c supervisor_vm_init()
> Generally speaking, the initial page table statically maps the DDR space
> to the page table structure.
>
> As for eret, I suppose the eret in run_loaded_program()?
> Processor leaves the current privilege level and jump back to the
> supposedly caller's address stored in epc.
> Here the mepc CSR is the target address.
> mepc CSR is the enrtry point of vmlinux, which is stored in the current
> data structure during load_elf().
>
> Hopefully you can figure it out,
> Wei
>
> On 03/06/16 21:11, Francesco Viggiano wrote:
>
> Thanks for the clarification Wei.  Now I can read and load the vmlinux
> file from SD, but I'm stacked somewhere else in the code I think.  I'm
> trying to debug the bbl inserting some printk here and there in the code.
>
> Could you explain me please,  if you know it,  1)where the vmlinux is
> loaded in memory,  2) what happen after the call to "eret" assembly
> instruction
>
> Thank you for you help!
>
> Francesco.
>
> On Fri, Jun 3, 2016, 06:36 Wei Song <ws327 at cam.ac.uk> wrote:
>
>> Hello Francesco,
>>
>> On 02/06/2016 21:25, Francesco Viggiano wrote:
>> > Hi all,
>> >
>> > I'm trying to boot Linux on my own system architecture. As for now, I
>> can
>> > successfully run the SD card test example provided with lowRisc project.
>> > I'd like more information on how to boot Linux, specifically:
>> >
>> > 1) My 1Gb DDR3 starts from address 0x0. I have a way to directly put a
>> > program in Main memory. So I don't need the first stage bootloader, but
>> I
>> > can directly load the revised bbl in DDR. I have just modified the DDR,
>> > uart and spi addresses on both bbl/ and  driver/ folders. Is this the
>> right
>> > way to proceed?
>> Yes, I believe you can directly use bbl if you can put it into DDR at
>> address 0x0 (but make sure the L1/L2 cache is clean?).
>> I am not what is needed to be changed in bbl. I was thinking you only
>> need to change the SPI_BASE and UART_BASE in driver.
>>
>> >
>> > 2) On my SD card I have put the pre-compiled linux image following this
>> > guide: www.lowrisc.org/docs/untether-v0.2/fpga-demo/#boot. So on my SD
>> card
>> > there are vmlinux and root.bin files.
>> >
>> > 3) When I run the bbl, It reaches the SD card, but it states: "fail to
>> open
>> > file vmlinux"
>> >
>> > My questions are:
>> > 1) Do I need to compile my own linux image (if so, what do I have to
>> > change?), or I can easily run yours?
>> No, you should be able to use mine.
>>
>> >
>> > 2) Is the FPU in the rocket core mandatory in order to run Linux?
>> No, in theory. Somebody has managed to run with a soft FPU, although I
>> am not what has been changed to do it other then disabling the hard FPU.
>>
>> >
>> > 3) Why does it fail to load the vmlinux file?
>> I cannot tell right now.
>> I believe it is the bbl/elf.c load_elf() complaining fail to load vmlinux?
>> Basically this means the bbl cannot read the vmlinux file from SD.
>> The SD card should be format in FAT32 which is by default.
>> It looks like you have done the sdcard test? example/sdcard
>> If that test works OK but bbl fails to load vmlinux, you might want to
>> dig deeper to see what is the error in file_open(), which is defined in
>> bbl/file().
>> Both the sdcard test and the bbl use the FatFS to support SD FAT32.
>> FatFS is located in driver/ff*
>> FatFS will be able to give you more detailed error code, then we might
>> be able to tell what went wrong.
>>
>> Best regards,
>> Wei
>>
>> >
>> > Thank you for your time and support,
>> >
>> > Francesco Viggiano
>> >
>> >
>>
>> --
>
> Francesco
>
>
> --

Francesco


More information about the lowrisc-dev mailing list