risc-v

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
risc-v [2022/02/28 10:29] – [kernel-meta/] rpjdayrisc-v [2022/03/01 14:09] (current) – [meta-riscv layer [abbreviated]] rpjday
Line 5: Line 5:
 = Links = Links
  
-=== OE-Core layer+== OE-Core layer
  
  * [[https://git.openembedded.org/openembedded-core/tree/|OE-Core]]  * [[https://git.openembedded.org/openembedded-core/tree/|OE-Core]]
Line 27: Line 27:
         * [[https://git.openembedded.org/openembedded-core/tree/meta/recipes-bsp/opensbi/opensbi_1.0.bb|opensbi_1.0.bb]]         * [[https://git.openembedded.org/openembedded-core/tree/meta/recipes-bsp/opensbi/opensbi_1.0.bb|opensbi_1.0.bb]]
         * [[https://git.openembedded.org/openembedded-core/tree/meta/recipes-bsp/opensbi/opensbi-payloads.inc|opensbi-payloads.inc]]         * [[https://git.openembedded.org/openembedded-core/tree/meta/recipes-bsp/opensbi/opensbi-payloads.inc|opensbi-payloads.inc]]
 +      * [[https://git.openembedded.org/openembedded-core/tree/meta/recipes-bsp/u-boot|u-boot/]]
 +        * [[https://git.openembedded.org/openembedded-core/tree/meta/recipes-bsp/u-boot/u-boot-common.inc|u-boot-common.inc]]
 +        * [[https://cgit.openembedded.org/openembedded-core/tree/meta/recipes-bsp/u-boot/u-boot.inc|u-boot.inc]]
 +        * [[https://cgit.openembedded.org/openembedded-core/tree/meta/recipes-bsp/u-boot/u-boot_2022.01.bb|u-boot_2022.01.bb]]
  
  
-=== meta-riscv layer [abbreviated]+== meta-riscv layer [abbreviated, unnecessary for QEMU]
  
   * [[https://github.com/riscv/meta-riscv|meta-riscv/]]   * [[https://github.com/riscv/meta-riscv|meta-riscv/]]
Line 37: Line 41:
     * [[https://github.com/riscv/meta-riscv/tree/master/recipes-bsp/u-boot|U-Boot stuff]]     * [[https://github.com/riscv/meta-riscv/tree/master/recipes-bsp/u-boot|U-Boot stuff]]
     * [[https://github.com/riscv/meta-riscv/tree/master/recipes-kernel/|recipes-kernel/]]     * [[https://github.com/riscv/meta-riscv/tree/master/recipes-kernel/|recipes-kernel/]]
-      * [[https://github.com/riscv/meta-riscv/tree/master/recipes-kernel/firmware|firmware/]] 
       * [[https://github.com/riscv/meta-riscv/tree/master/recipes-kernel/linux|linux/]]       * [[https://github.com/riscv/meta-riscv/tree/master/recipes-kernel/linux|linux/]]
  
-=== GitHub riscv-software-src+== GitHub riscv-software-src
  
   * [[https://github.com/riscv-software-src|Main Page]]   * [[https://github.com/riscv-software-src|Main Page]]
     * [[https://github.com/riscv-software-src/opensbi|opensbi]]     * [[https://github.com/riscv-software-src/opensbi|opensbi]]
  
-=== Resources+== Resources
  
   * [[https://riscv.org/|https://riscv.org]]   * [[https://riscv.org/|https://riscv.org]]
Line 54: Line 57:
 = Building for qemuriscv64 = Building for qemuriscv64
  
-=== qemuriscv64+== qemuriscv64
  
 Note that, for the QEMU build, there is no need for the ''meta-riscv'' layer, just ''openembedded-core''. Note that, for the QEMU build, there is no need for the ''meta-riscv'' layer, just ''openembedded-core''.
Line 63: Line 66:
 </code> </code>
  
-=== qemuriscv.sh+== qemuriscv.sh
  
 To invoke your own script, remove ''-device bochs-display'' added by ''runqemu''. To invoke your own script, remove ''-device bochs-display'' added by ''runqemu''.
Line 88: Line 91:
 </code> </code>
  
-Why create a kernel containing-payload if you don't use it?+Why create a kernel containing-payload if you don't use it? Also, appears that the serial console is ''ttyS0'', and you can drop the ''console=hvc0 earlycon=sbi'' stuff, still works.
  
-=== tmp/deploy/images/qemuriscv64+== tmp/deploy/images/qemuriscv64
  
 Note which generated artifacts are used in the call to QEMU: Note which generated artifacts are used in the call to QEMU:
Line 135: Line 138:
 = The RISC-V kernel = The RISC-V kernel
  
-=== linux-yocto_5.15.bb+== linux-yocto_5.15.bb
  
-Carefully selected snippets:+Snippets:
  
 <code> <code>
Line 145: Line 148:
 SRC_URI = "git://git.yoctoproject.org/linux-yocto.git;name=machine;branch=${KBRANCH}; \ SRC_URI = "git://git.yoctoproject.org/linux-yocto.git;name=machine;branch=${KBRANCH}; \
            git://git.yoctoproject.org/yocto-kernel-cache;type=kmeta;name=meta;branch=yocto-5.15;destsuffix=${KMETA}"            git://git.yoctoproject.org/yocto-kernel-cache;type=kmeta;name=meta;branch=yocto-5.15;destsuffix=${KMETA}"
 +           
 + # Functionality flags
 +KERNEL_EXTRA_FEATURES ?= "features/netfilter/netfilter.scc"
 +KERNEL_FEATURES:append = " ${KERNEL_EXTRA_FEATURES}"
 +KERNEL_FEATURES:append:qemuall=" cfg/virtio.scc features/drm-bochs/drm-bochs.scc"          
 </code> </code>
-=== Generated image/boot/ artifacts+== Generated RISC-V image/boot/ artifacts
  
 <code> <code>
Line 157: Line 165:
 </code> </code>
  
-=== Selected snippets from kernel-meta/+== Selected snippets from kernel-meta/
  
-==== arch/riscv/+=== arch/riscv/
  
-===== riscv.scc+==== riscv.scc
  
 <code> <code>
Line 170: Line 178:
 </code> </code>
  
-===== riscv.cfg+==== riscv.cfg
  
 <code> <code>
Line 184: Line 192:
 </code> </code>
  
-==== bsp/qemuriscv64/+=== bsp/qemuriscv64/
  
-===== qemuriscv64.cfg+==== qemuriscv64.cfg
  
 <code> <code>
Line 227: Line 235:
 </code> </code>
  
-===== qemuriscv64.scc+==== qemuriscv64.scc
  
 <code> <code>
Line 236: Line 244:
 </code> </code>
  
-===== qemuriscv64-standard.scc+==== qemuriscv64-standard.scc
  
 <code> <code>
Line 249: Line 257:
 </code> </code>
  
 +== On the running QEMU session
 +
 +<code>
 +root@qemuriscv64:/proc# gunzip -c /proc/config.gz | grep RISC
 +CONFIG_RISCV=y
 +CONFIG_RISCV_SBI=y
 +CONFIG_RISCV_ERRATA_ALTERNATIVE=y
 +CONFIG_RISCV_ISA_C=y
 +CONFIG_RISCV_BASE_PMU=y
 +CONFIG_RISCV_SBI_V01=y
 +# CONFIG_SERIAL_EARLYCON_RISCV_SBI is not set
 +# CONFIG_HVC_RISCV_SBI is not set
 +CONFIG_RISCV_TIMER=y
 +CONFIG_RISCV_INTC=y
 +</code>
 = opensbi = opensbi
  
-=== qemuriscv.inc variables+== qemuriscv.inc variables
  
 <code> <code>
Line 257: Line 280:
 RISCV_SBI_PLAT ?= "generic" RISCV_SBI_PLAT ?= "generic"
 RISCV_SBI_PAYLOAD ?= "${KERNEL_IMAGETYPE}-${MACHINE}.bin" RISCV_SBI_PAYLOAD ?= "${KERNEL_IMAGETYPE}-${MACHINE}.bin"
 +
 +UBOOT_ENTRYPOINT:riscv32 = "0x80400000"
 +UBOOT_ENTRYPOINT:riscv64 = "0x80200000"
 </code> </code>
  
-=== opensbi-payloads.inc+== opensbi-payloads.inc
  
 <code> <code>
Line 300: Line 326:
 </code> </code>
  
-=== opensbi_1.0.bb [master branch]+== opensbi_1.0.bb [master branch]
  
 <code> <code>
 +require opensbi-payloads.inc
 +
 +inherit autotools-brokensep deploy
 +
 +SRCREV = "ce4c0188d96b2c20c2e08d24646a5e517fe15a4b"
 +SRC_URI = "git://github.com/riscv/opensbi.git;branch=master;protocol=https \
 +          "
 +
 +S = "${WORKDIR}/git"
 +
 EXTRA_OEMAKE += "PLATFORM=${RISCV_SBI_PLAT} I=${D} FW_PIC=n CLANG_TARGET= " EXTRA_OEMAKE += "PLATFORM=${RISCV_SBI_PLAT} I=${D} FW_PIC=n CLANG_TARGET= "
 # If RISCV_SBI_PAYLOAD is set then include it as a payload # If RISCV_SBI_PAYLOAD is set then include it as a payload
Line 330: Line 366:
 FILES:${PN} += "/share/opensbi/*/${RISCV_SBI_PLAT}/firmware/fw_payload.*" FILES:${PN} += "/share/opensbi/*/${RISCV_SBI_PLAT}/firmware/fw_payload.*"
 FILES:${PN} += "/share/opensbi/*/${RISCV_SBI_PLAT}/firmware/fw_dynamic.*" FILES:${PN} += "/share/opensbi/*/${RISCV_SBI_PLAT}/firmware/fw_dynamic.*"
-</code> 
  
-=== bitbake -e opensbi+COMPATIBLE_HOST "(riscv64|riscv32).*" 
 +INHIBIT_PACKAGE_STRIP = "1" 
 + 
 +SECURITY_CFLAGS = "" 
 +</code> 
 +== bitbake -e opensbi
  
 <code> <code>
Line 346: Line 386:
 </code> </code>
  
-=== git/build/platform/generic/firmware+== git/build/platform/generic/firmware 
 + 
 +With (default) kernel payload:
  
 <code> <code>
Line 357: Line 399:
 </code> </code>
  
-=== log.do_compile+With ''u-boot.bin'' payload (note much smaller payload files): 
 + 
 +<code> 
 +-rwxr-xr-x. 2 rpjday rpjday   96496 Mar  1 06:10 fw_dynamic.bin 
 +-rwxr-xr-x. 2 rpjday rpjday  938520 Mar  1 06:10 fw_dynamic.elf 
 +-rwxr-xr-x. 2 rpjday rpjday   96496 Mar  1 06:10 fw_jump.bin 
 +-rwxr-xr-x. 2 rpjday rpjday  938104 Mar  1 06:10 fw_jump.elf 
 +-rwxr-xr-x. 2 rpjday rpjday 2713192 Mar  1 06:10 fw_payload.bin 
 +-rwxr-xr-x. 2 rpjday rpjday 1554336 Mar  1 06:10 fw_payload.elf 
 +</code> 
 + 
 +== log.do_compile
  
 <code> <code>
Line 367: Line 420:
 </code> </code>
  
-=== git/platform/generic/config.mk+== git/platform/generic/config.mk
  
 <code> <code>
  • risc-v.1646044155.txt.gz
  • Last modified: 2022/02/28 10:29
  • by rpjday