[Letux-kernel] X1600 / LX16 support - here: compile issue

H. Nikolaus Schaller hns at goldelico.com
Thu Feb 8 16:29:02 CET 2024



> Am 07.02.2024 um 22:51 schrieb H. Nikolaus Schaller <hns at goldelico.com>:
> 
>> We have
>> CONFIG_BUILTIN_DTB=y
>> CONFIG_MIPS_NO_APPENDED_DTB=y
>> # CONFIG_MIPS_ELF_APPENDED_DTB is not set
>> # CONFIG_MIPS_RAW_APPENDED_DTB is not set
>> 
>> So if DTB is somehow builtin and not appended,
> 
> I think (guess) I remember that this are two different methods to include the DTB in the uImage.
> It did need some experimentation to get it work with our U-Boot like with the vendor kernel.
> 
> At least CONFIG_BUILTIN_DTB seems to be a generic kernel feature while 
> CONFIG_MIPS_NO_APPENDED_DTB is MIP specific.

This is what the build log says:

  CALL    scripts/checksyscalls.sh - due to target is PHONY
  DTC     arch/mips/boot/dts/ingenic/lx16.dtb - due to: arch/mips/boot/dts/ingenic/x1600.dtsi
  WRAP    arch/mips/boot/dts/ingenic/lx16.dtb.S - due to: arch/mips/boot/dts/ingenic/lx16.dtb
  AS      arch/mips/boot/dts/ingenic/lx16.dtb.o - due to: arch/mips/boot/dts/ingenic/lx16.dtb.S
  AR      arch/mips/boot/dts/ingenic/built-in.a - due to: arch/mips/boot/dts/ingenic/lx16.dtb.o
  AR      arch/mips/boot/dts/built-in.a - due to: arch/mips/boot/dts/ingenic/built-in.a
  AR      built-in.a - due to: arch/mips/boot/dts/built-in.a

So I conclude the DTB is processed as an assembler file (with .incline)
which defines __dtb_lx16_begin and __dtb_lx16_end.

This is processed in get_fdt(void) - if CONFIG_BUILTIN_DTB=y
Which is where some gcc versions may complain about.

get_fdt() then searches for a magic, but only if CONFIG_MIPS_RAW_APPENDED_DTB=y or CONFIG_MIPS_ELF_APPENDED_DTB=y.
Hence both do not need to be set if we are sure we want to use CONFIG_BUILTIN_DTB=y.

In other words: we do not use the "append to image" modes but it is compiled like a built-in driver.
And some code can refer to the start/end address. Whereever the linker places this in the
text segment. Quite clever and reduces risk of mistakes in postprocessing the vmlinux/linuz
images.

Maybe this CONFIG_BUILTIN_DTB works for any architecture? No, just loongarch, mips, riscv, sh, xtensa.
Not for ARM which is why we don't know it yet :)

BR,
NIkolaus



More information about the Letux-kernel mailing list