diff --git a/beaglev.yml b/beaglev.yml new file mode 100644 index 0000000..4c60d35 --- /dev/null +++ b/beaglev.yml @@ -0,0 +1,47 @@ +header: + version: 8 + +distro: poky + +machine: beaglev-starlight-jh7100 + +target: + - core-image-minimal + +repos: + meta-riscv: + + poky: + url: https://git.yoctoproject.org/git/poky + refspec: aa8618b6245d4910a323f198652983e39e3984fe + layers: + meta: + meta-poky: + meta-yocto-bsp: + + meta-openembedded: + url: https://git.openembedded.org/meta-openembedded + refspec: 71b546ed8595b14d29efc1e8b951f8c845ad10c4 + layers: + meta-oe: + +bblayers_conf_header: + standard: | + POKY_BBLAYERS_CONF_VERSION = "2" + BBPATH = "${TOPDIR}" + BBFILES ?= "" +local_conf_header: + standard: | + CONF_VERSION = "1" + PACKAGE_CLASSES = "package_rpm" + SDKMACHINE = "x86_64" + diskmon: | + BB_DISKMON_DIRS = "\ + STOPTASKS,${TMPDIR},1G,100K \ + STOPTASKS,${DL_DIR},1G,100K \ + STOPTASKS,${SSTATE_DIR},1G,100K \ + STOPTASKS,/tmp,100M,100K \ + ABORT,${TMPDIR},100M,1K \ + ABORT,${DL_DIR},100M,1K \ + ABORT,${SSTATE_DIR},100M,1K \ + ABORT,/tmp,10M,1K" diff --git a/conf/machine/beaglev-starlight-jh7100.conf b/conf/machine/beaglev-starlight-jh7100.conf new file mode 100644 index 0000000..1bd49c3 --- /dev/null +++ b/conf/machine/beaglev-starlight-jh7100.conf @@ -0,0 +1,85 @@ +#@TYPE: Machine +#@NAME: beaglev-starlight-jh7100 +#@SOC: StarFive JH7100 +#@DESCRIPTION: Machine configuration for the beta BeagleV Starlight board + +require conf/machine/include/riscv/tune-riscv.inc + +MACHINE_FEATURES = "screen keyboard ext2 ext3 serial" + +KERNEL_IMAGETYPE = "Image" + +PREFERRED_PROVIDER_virtual/kernel ?= "linux-beaglev" +PREFERRED_PROVIDER_virtual/bootloader ?= "u-boot-beaglev" + +PREFERRED_VERSION_openocd-native = "riscv" +PREFERRED_VERSION_openocd = "riscv" + +EXTRA_IMAGEDEPENDS += "opensbi" +RISCV_SBI_PLAT = "sifive/vic7100" + +## This sets u-boot as the default OpenSBI payload +RISCV_SBI_PAYLOAD ?= "u-boot.bin" +## This will set the kernel as the OpenSBI payload. This is not recommended, +## you can use U-Boot's MMC loading instead. +# RISCV_SBI_PAYLOAD ?= "${KERNEL_IMAGETYPE}-${MACHINE}.bin" + +RISCV_SBI_FDT ?= "starfive_vic7100_beagle_v.dtb" + +SERIAL_CONSOLES = "115200;ttySIF0" + +MACHINE_EXTRA_RRECOMMENDS += " kernel-modules" + +IMAGE_FSTYPES += "wic.gz ext4" +KERNEL_DEVICETREE ?= "sifive/${RISCV_SBI_FDT}" + +## Do not update fstab file when using wic images +WIC_CREATE_EXTRA_ARGS ?= "--no-fstab-update" + +EXTRA_IMAGEDEPENDS += "u-boot-beaglev" +UBOOT_MACHINE = "starfive_vic7100_beagle_v_smode_defconfig" + +UBOOT_ENTRYPOINT = "0x80200000" +UBOOT_DTB_LOADADDRESS = "0x82200000" + +## wic default support +WKS_FILE_DEPENDS ?= " \ + opensbi \ + e2fsprogs-native \ + bmap-tools-native \ +" + +IMAGE_BOOT_FILES ?= " \ + fw_payload.bin \ + ${KERNEL_IMAGETYPE} \ + ${RISCV_SBI_FDT} \ + extlinux.conf \ +" + +WKS_FILE ?= "beaglev-rootfs.wks" + +BAD_RECOMMENDATIONS += "\ + libcxx-dev \ + libcxx-staticdev \ + compiler-rt-dev \ + compiler-rt-staticdev \ +" +ASSUME_PROVIDED += "\ + libcxx-dev \ + libcxx-staticdev \ + compiler-rt-dev \ + compiler-rt-staticdev \ +" + +# extlinux configuration +UBOOT_EXTLINUX = "1" +UBOOT_EXTLINUX_CONSOLE = "console=ttyS0,115200" +UBOOT_EXTLINUX_LABELS = "linux" +UBOOT_EXTLINUX_KERNEL_ARGS = "earlyprintk rootwait" +UBOOT_EXTLINUX_KERNEL_IMAGE = "Image" +UBOOT_EXTLINUX_FDTDIR = "/" +UBOOT_EXTLINUX_FDT = "${RISCV_SBI_FDT}" +UBOOT_EXTLINUX_MENU_DESCRIPTION = "Yocto Linux" +UBOOT_EXTLINUX_ROOT = "root=/dev/mmcblk0p2" +UBOOT_EXTLINUX_TIMEOUT = "10" +UBOOT_EXTLINUX_DEFAULT_LABEL = "linux" diff --git a/recipes-bsp/opensbi/opensbi-beaglev_0.8.0.bb b/recipes-bsp/opensbi/opensbi-beaglev_0.8.0.bb new file mode 100644 index 0000000..863b236 --- /dev/null +++ b/recipes-bsp/opensbi/opensbi-beaglev_0.8.0.bb @@ -0,0 +1,48 @@ +SUMMARY = "RISC-V Open Source Supervisor Binary Interface (OpenSBI)" +DESCRIPTION = "OpenSBI aims to provide an open-source and extensible implementation of the RISC-V SBI specification for a platform specific firmware (M-mode) and a general purpose OS, hypervisor or bootloader (S-mode or HS-mode). OpenSBI implementation can be easily extended by RISC-V platform or System-on-Chip vendors to fit a particular hadware configuration." +HOMEPAGE = "https://github.com/riscv/opensbi" +LICENSE = "BSD-2-Clause" +LIC_FILES_CHKSUM = "file://COPYING.BSD;md5=42dd9555eb177f35150cf9aa240b61e5" + +require recipes-bsp/opensbi/opensbi-payloads.inc + +inherit autotools-brokensep deploy + +SRCREV = "2524b0ecd8684b42bc7a4c69794f40f11cbbe2a5" +SRC_URI = "git://github.com/starfive-tech/opensbi.git;branch=Fedora \ + file://0001-Makefile-Don-t-specify-mabi-or-march.patch \ + " + +S = "${WORKDIR}/git" + +EXTRA_OEMAKE += "PLATFORM=${RISCV_SBI_PLAT} I=${D}" +# If RISCV_SBI_PAYLOAD is set then include it as a payload +EXTRA_OEMAKE_append = " ${@riscv_get_extra_oemake_image(d)}" + +# Required if specifying a custom payload +do_compile[depends] += "${@riscv_get_do_compile_depends(d)}" + +do_install_append() { + # In the future these might be required as a dependency for other packages. + # At the moment just delete them to avoid warnings + rm -r ${D}/include + rm -r ${D}/lib* + rm -r ${D}/share/opensbi/*/${RISCV_SBI_PLAT}/firmware/payloads +} + +do_deploy () { + install -m 755 ${D}/share/opensbi/*/${RISCV_SBI_PLAT}/firmware/fw_payload.* ${DEPLOYDIR}/ + install -m 755 ${D}/share/opensbi/*/${RISCV_SBI_PLAT}/firmware/fw_jump.* ${DEPLOYDIR}/ + install -m 755 ${D}/share/opensbi/*/${RISCV_SBI_PLAT}/firmware/fw_dynamic.* ${DEPLOYDIR}/ +} + +addtask deploy before do_build after do_install + +FILES_${PN} += "/share/opensbi/*/${RISCV_SBI_PLAT}/firmware/fw_jump.*" +FILES_${PN} += "/share/opensbi/*/${RISCV_SBI_PLAT}/firmware/fw_payload.*" +FILES_${PN} += "/share/opensbi/*/${RISCV_SBI_PLAT}/firmware/fw_dynamic.*" + +COMPATIBLE_HOST = "(riscv64|riscv32).*" +INHIBIT_PACKAGE_STRIP = "1" + +SECURITY_CFLAGS = "" diff --git a/recipes-bsp/u-boot/u-boot-beaglev/0001-include-configs-starfive-vic7100-adjust-fdt_addr_r.patch b/recipes-bsp/u-boot/u-boot-beaglev/0001-include-configs-starfive-vic7100-adjust-fdt_addr_r.patch new file mode 100644 index 0000000..01c37a4 --- /dev/null +++ b/recipes-bsp/u-boot/u-boot-beaglev/0001-include-configs-starfive-vic7100-adjust-fdt_addr_r.patch @@ -0,0 +1,38 @@ +From 2c4c813940c577590f3352cef0c49a8def17905d Mon Sep 17 00:00:00 2001 +From: Thomas Petazzoni +Date: Wed, 28 Apr 2021 22:58:45 +0200 +Subject: [PATCH] include/configs/starfive-vic7100: adjust fdt_addr_r + +The default fdt_addr_r of 0x88000000 doesn't work, the kernel never +boots. Using 0x90000000 works fine. + +Since it would overlap with the kernel_comp_addr_r area, this one is +moved 16 MB further, at 0x91000000. + +Signed-off-by: Thomas Petazzoni +--- + include/configs/starfive-vic7100.h | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +diff --git a/include/configs/starfive-vic7100.h b/include/configs/starfive-vic7100.h +index 8c5915a73c..7150a23873 100644 +--- a/include/configs/starfive-vic7100.h ++++ b/include/configs/starfive-vic7100.h +@@ -111,13 +111,13 @@ + "fdt_high=0xffffffffffffffff\0" \ + "initrd_high=0xffffffffffffffff\0" \ + "kernel_addr_r=0x84000000\0" \ +- "fdt_addr_r=0x88000000\0" \ ++ "fdt_addr_r=0x90000000\0" \ + "scriptaddr=0x88100000\0" \ + "script_offset_f=0x1fff000\0" \ + "script_size_f=0x1000\0" \ + "pxefile_addr_r=0x88200000\0" \ + "ramdisk_addr_r=0x88300000\0" \ +- "kernel_comp_addr_r=0x90000000\0" \ ++ "kernel_comp_addr_r=0x91000000\0" \ + "kernel_comp_size=0x10000000\0" \ + "type_guid_gpt_loader1=" TYPE_GUID_LOADER1 "\0" \ + "type_guid_gpt_loader2=" TYPE_GUID_LOADER2 "\0" \ +-- +2.30.2 diff --git a/recipes-bsp/u-boot/u-boot-beaglev_v2021.04.bb b/recipes-bsp/u-boot/u-boot-beaglev_v2021.04.bb new file mode 100644 index 0000000..d222400 --- /dev/null +++ b/recipes-bsp/u-boot/u-boot-beaglev_v2021.04.bb @@ -0,0 +1,10 @@ +require recipes-bsp/u-boot/u-boot-common.inc +require recipes-bsp/u-boot/u-boot.inc + +SRC_URI = "git://github.com/starfive-tech/u-boot.git;protocol=git;branch=Fedora" + +SRC_URI += " \ + file://0001-include-configs-starfive-vic7100-adjust-fdt_addr_r.patch \ +" + +SRCREV = "3f3ac01a29ad1cd5fa519d86f81daead2447f1d4" diff --git a/recipes-kernel/linux/linux-beaglev_5.10.bb b/recipes-kernel/linux/linux-beaglev_5.10.bb new file mode 100644 index 0000000..2e1e09d --- /dev/null +++ b/recipes-kernel/linux/linux-beaglev_5.10.bb @@ -0,0 +1,18 @@ +SUMMARY = "An example kernel recipe that uses the linux-yocto and oe-core" + +inherit kernel +require recipes-kernel/linux/linux-yocto.inc + +SRC_URI = "git://github.com/starfive-tech/linux.git;protocol=git;branch=Fedora" + +LINUX_VERSION ?= "5.10.6" +LINUX_VERSION_EXTENSION_append = "-beaglev" + +SRCREV = "710cf052d6abda73584481d920b4b6befc7240ea" + +PV = "${LINUX_VERSION}+git${SRCPV}" + +KCONFIG_MODE = "--alldefconfig" +KBUILD_DEFCONFIG_beaglev-starlight-jh7100 = "starfive_vic7100_evb_sd_net_defconfig" + +COMPATIBLE_MACHINE = "(beaglev-starlight-jh7100)" diff --git a/wic/beaglev.wks b/wic/beaglev.wks new file mode 100644 index 0000000..5e76795 --- /dev/null +++ b/wic/beaglev.wks @@ -0,0 +1,6 @@ +# short-description: Create SD card image for BeagleV Starlight development board + +part /boot --source bootimg-partition --ondisk mmcblk0 --fstype=vfat --label boot --active --size=100M --align 4096 +part / --source rootfs --ondisk mmcblk0 --fstype=ext4 --label root --align 4096 --size 1G + +bootloader --ptable gpt