Skip to content

pk does not support custom DTS in my case #345

@mtravaillard

Description

@mtravaillard

We faced a problem with @CyrilKoe when trying to run pk after compiling it with the flag --with-dts.

We compiled the pk with the following command :

../configure --prefix=`realpath ../install/` --host=riscv64-unknown-elf --with-dts=/path_to_dts/custom.dts

The custom DTS file was succesfully compiled to a DTB file, we had a custom.dtb file in the build folder. When decompiling it, we had the same information than in custom dts file, we also had the correct magic word and version as checked in the fdt_scan function.

They program encountered a problem at the assertion line 209, in the function query_mem of the file machine/fdt.c.

This was caused by the DTB file not being stored because it address was set at 0x0000.
As we can see in the generate pk ELF with the following command :

$ readelf -a ../install/riscv64-unknown-elf/bin/pk | grep dtb_start
   347: 0000000000000000     0 NOTYPE  GLOBAL DEFAULT    9 dtb_start

We fixed this by adding it into the data part from the pk.lds file :

  /* data: Writable data */
  .data : 
  {
    *(.data)
    *(.data.*)
    *(.srodata*)
    *(.gnu.linkonce.d.*)
    *(.comment)
    *(.dtb)
  }

We added the *(.dtb).
Now pk is running correctly and is pooling an host register, as expected.

Is this an issue in the linker script, or have we not built the pk properly ?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions