From c881a6ede3a97f6315984a690151383d514fbeae Mon Sep 17 00:00:00 2001 From: Alistair Francis Date: Wed, 5 May 2021 13:03:28 +1000 Subject: [PATCH] machine/beaglev-starlight-jh7100: Use fitImage Update the boot process to follow the HiFive1. Signed-off-by: Alistair Francis --- conf/machine/beaglev-starlight-jh7100.conf | 19 ++------ .../u-boot/u-boot-starfive_v2021.04.bb | 45 ++++++++++++++----- recipes-kernel/linux/linux-starfive/extra.cfg | 4 ++ recipes-kernel/linux/linux-starfive_5.10.bb | 4 +- 4 files changed, 44 insertions(+), 28 deletions(-) create mode 100644 recipes-kernel/linux/linux-starfive/extra.cfg diff --git a/conf/machine/beaglev-starlight-jh7100.conf b/conf/machine/beaglev-starlight-jh7100.conf index b5df620..dc24152 100644 --- a/conf/machine/beaglev-starlight-jh7100.conf +++ b/conf/machine/beaglev-starlight-jh7100.conf @@ -7,7 +7,9 @@ require conf/machine/include/riscv/tune-riscv.inc MACHINE_FEATURES = "screen keyboard ext2 ext3 serial" -KERNEL_IMAGETYPE = "Image" +KERNEL_CLASSES = "kernel-fitimage" +KERNEL_IMAGETYPE = "fitImage" +UBOOT_ENV ?= "tftp-mmc-boot" PREFERRED_PROVIDER_virtual/kernel ?= "linux-starfive" PREFERRED_PROVIDER_virtual/bootloader ?= "u-boot-starfive" @@ -50,20 +52,7 @@ IMAGE_BOOT_FILES ?= " \ fw_payload.bin \ ${KERNEL_IMAGETYPE} \ ${RISCV_SBI_FDT} \ - boot/extlinux/extlinux.conf \ + boot.scr.uimg \ " WKS_FILE ?= "beaglev.wks" - -# extlinux configuration -UBOOT_EXTLINUX = "1" -UBOOT_EXTLINUX_CONSOLE = "console=ttyS0,115200" -UBOOT_EXTLINUX_LABELS = "linux" -UBOOT_EXTLINUX_KERNEL_ARGS = "earlyprintk rootwait rootdelay=2 panic=30" -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/u-boot/u-boot-starfive_v2021.04.bb b/recipes-bsp/u-boot/u-boot-starfive_v2021.04.bb index bf2ac75..760a71c 100644 --- a/recipes-bsp/u-boot/u-boot-starfive_v2021.04.bb +++ b/recipes-bsp/u-boot/u-boot-starfive_v2021.04.bb @@ -1,18 +1,39 @@ 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" +FILESEXTRAPATHS_prepend := "${THISDIR}/files:" -SRC_URI += " \ - file://0001-include-configs-starfive-vic7100-adjust-fdt_addr_r.patch \ -" - -#FIXME: U-Boot by default wants the extlinux.conf in the /boot/extlinux/extlinux.conf path -do_deploy_append() { - if [ ! -d ${DEPLOYDIR}/boot/extlinux ]; then - install -d ${DEPLOYDIR}/boot/extlinux - fi - cp ${DEPLOYDIR}/extlinux.conf ${DEPLOYDIR}/boot/extlinux -} +SRC_URI = "git://github.com/starfive-tech/u-boot.git;protocol=git;branch=Fedora \ + file://0001-include-configs-starfive-vic7100-adjust-fdt_addr_r.patch \ + file://tftp-mmc-boot.txt \ + " SRCREV = "3f3ac01a29ad1cd5fa519d86f81daead2447f1d4" + +DEPENDS_append = " u-boot-tools-native" + +# Overwrite this for your server +TFTP_SERVER_IP ?= "127.0.0.1" + +do_configure_prepend() { + sed -i -e 's,@SERVERIP@,${TFTP_SERVER_IP},g' ${WORKDIR}/tftp-mmc-boot.txt + + if [ -f "${WORKDIR}/${UBOOT_ENV}.txt" ]; then + mkimage -O linux -T script -C none -n "U-Boot boot script" \ + -d ${WORKDIR}/${UBOOT_ENV}.txt ${WORKDIR}/boot.scr.uimg + fi +} + +do_deploy_append() { + if [ -f "${WORKDIR}/boot.scr.uimg" ]; then + install -d ${DEPLOY_DIR_IMAGE} + install -m 755 ${WORKDIR}/boot.scr.uimg ${DEPLOY_DIR_IMAGE} + fi + + if [ -f "${WORKDIR}/uEnv.txt" ]; then + install -d ${DEPLOY_DIR_IMAGE} + install -m 755 ${WORKDIR}/uEnv.txt ${DEPLOY_DIR_IMAGE} + fi +} + +FILES_${PN}_append = " /boot/boot.scr.uimg" diff --git a/recipes-kernel/linux/linux-starfive/extra.cfg b/recipes-kernel/linux/linux-starfive/extra.cfg new file mode 100644 index 0000000..7d06542 --- /dev/null +++ b/recipes-kernel/linux/linux-starfive/extra.cfg @@ -0,0 +1,4 @@ +CONFIG_CMDLINE="root=/dev/mmcblk0p2 rootwait rootdelay=3 console=ttyS0,115200" +# CONFIG_INITRAMFS_FORCE is not set +# CONFIG_CMDLINE_FALLBACK is not set +CONFIG_CMDLINE_FORCE=y diff --git a/recipes-kernel/linux/linux-starfive_5.10.bb b/recipes-kernel/linux/linux-starfive_5.10.bb index 24c70f5..e9c35dc 100644 --- a/recipes-kernel/linux/linux-starfive_5.10.bb +++ b/recipes-kernel/linux/linux-starfive_5.10.bb @@ -3,7 +3,9 @@ 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" +SRC_URI = "git://github.com/starfive-tech/linux.git;protocol=git;branch=Fedora \ + file://extra.cfg \ + " # The dts files are only in U-Boot repo currently SRC_URI += "file://0001-sync-beaglev-dts-from-u-boot.patch"