openhwgroup / cva6-sdk

CVA6 SDK containing RISC-V tools and Buildroot
60 stars 65 forks source link

Kernel Configuration #35

Open Kendidi opened 4 years ago

Kendidi commented 4 years ago

Hi,

I have some questions regarding configurating the Kernel build for vmlinux.

I was under the impression that changes made in ".../ariane-sdk/configs/linux_defconfig" and in ".../ariane-sdk/configs/buildroot_defconfig" will be copied to ".../ariane-sdk/buildroot/.config" or applied somehow during "make vmlinux". Is that how it's supposed to work? Please correct me if I am wrong.

  1. I want to add debug symbols to the build, so I added "CONFIG_DEBUG_INFO=y" to file, "linux_defconfig". I can see that the resulted vmlinux size grew a lot. So I assume it was successful and debug symbols have added to the ELF file. But then when I look at ".config", I do not see that option there.

  2. I want to add DTS info to the kernel, so I ran "make menuconfig" at ".../ariane-sdk/buildroot/", and added a path to option, "Kernel --->Build a Device Tree Blob (DTB) ". After running "make vmlinux", I found that my changes made to ".config" is gone. And vmlinux file size did not seem to have changed. I also tried adding, "#BR2_LINUX_KERNEL_CUSTOM_DTS_PATH="/home/aie/ariane-sdk/ariane.dts" to "buildroot_defconfig" but that didn't seem to do anything as well. Would you please advise what's the proper way to config Kernel? And how to config options like BR2_LINUX_KERNEL_CUSTOM_DTS_PATH?

  3. I found "CONFIG_PAGE_OFFSET=0xffffffe000000000" in ".../ariane-sdk/buildroot/output/build/linux-ariane-v0.7/arch/riscv/configs/defconfig" after running "make menuconfig". I think the address was generated on the run. Where and how can we change the value to something else? (E.g. CONFIG_PAGE_OFFSET=0x200000000".)

  4. After vmlinux is loaded via GDB, I saw the following: ra 0xdeadbeefdeadbeef -2401053088876216593 sp 0x0000000083fffff0 2214592496 How do we config stack point (SP) in Kernel config to a more reasonable address corresponds to PAGE_OFFSET? (E.g. 0x207FFFFF0) And does register RA looks OK at startup?

  5. I am planning to run Kernel loaded onto beginning of DRAM (0x2_0000_0000). In "ariane.dts" that's used to build Ariane ROM, memory is set as "memory@0x200000000". Will that be OK? Or should I load kernel to a DRAM region outside the region described in ariane.dts so Kernel can use DRAM properly?

Many thanks in advance!

Moschn commented 4 years ago

General comment: The linux kernel and buildroot use a local .config file. However this file is huge and they also provide a way to save a 'defconfig' which is basically all to the config file from a stock one. These defconfig files are a lot shorter in size. We use the defconfig files. During the compilation, the .config files get overwritten. So If you want to change anything, it is easier if you do it in the defconfig file. You can also make changes to linux or buildroot with menuconfig and then after that run make savedefconfig to export the new defconfig. You still might have to copy it to the correct location.

The detailed questions are mostly linux or buildroot related. I would advise to ask in a forum/chat for these specific tools. I sadly do not have enough experience to answer all of your questions.

  1. I believe the initial stack pointer is set up by the bootloader. Independent of your openOCD or GDB session. As such you would have to change it there.
Kendidi commented 4 years ago

I see. Thank you Moritz!  Appreciate it. 

Sent from Yahoo Mail for iPhone

On Friday, August 7, 2020, 12:49 AM, Moritz Schneider notifications@github.com wrote:

General comment: The linux kernel and buildroot use a local .config file. However this file is huge and they also provide a way to save a 'defconfig' which is basically all to the config file from a stock one. These defconfig files are a lot shorter in size. We use the defconfig files. During the compilation, the .config files get overwritten. So If you want to change anything, it is easier if you do it in the defconfig file. You can also make changes to linux or buildroot with menuconfig and then after that run make savedefconfig to export the new defconfig. You still might have to copy it to the correct location.

The detailed questions are mostly linux or buildroot related. I would advise to ask in a forum/chat for these specific tools. I sadly do not have enough experience to answer all of your questions.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub, or unsubscribe.