diff -Nru u-boot-nezha-2022.04+git20220405.7446a472/debian/changelog u-boot-nezha-2022.04+git20220405.7446a472/debian/changelog --- u-boot-nezha-2022.04+git20220405.7446a472/debian/changelog 2022-06-16 12:37:21.000000000 +0200 +++ u-boot-nezha-2022.04+git20220405.7446a472/debian/changelog 2022-11-17 09:41:27.000000000 +0100 @@ -1,3 +1,11 @@ +u-boot-nezha (2022.04+git20220405.7446a472-0ubuntu0.22.04.0) jammy; urgency=medium + + * Build U-Boot for the LicheeRV board (LP: #1996790) + * Building against the updated OpenSBI provides support for fence.tso + emulation (LP: #1995261) + + -- Heinrich Schuchardt Thu, 17 Nov 2022 09:41:27 +0100 + u-boot-nezha (2022.04+git20220405.7446a472-0ubuntu0.1) jammy; urgency=medium * No-change backport to jammy to detect RAM size automatically diff -Nru u-boot-nezha-2022.04+git20220405.7446a472/debian/install u-boot-nezha-2022.04+git20220405.7446a472/debian/install --- u-boot-nezha-2022.04+git20220405.7446a472/debian/install 2022-04-21 11:19:39.000000000 +0200 +++ u-boot-nezha-2022.04+git20220405.7446a472/debian/install 2022-11-16 18:05:01.000000000 +0100 @@ -1 +1,2 @@ -u-boot.toc1 /usr/lib/u-boot/nezha +build_nezha/u-boot.toc1 /usr/lib/u-boot/nezha +build_licheerv/u-boot.toc1 /usr/lib/u-boot/licheerv diff -Nru u-boot-nezha-2022.04+git20220405.7446a472/debian/patches/0006-configs-Add-CONFIG_OF_BOARD_PLATFORM-as-default-for-.patch u-boot-nezha-2022.04+git20220405.7446a472/debian/patches/0006-configs-Add-CONFIG_OF_BOARD_PLATFORM-as-default-for-.patch --- u-boot-nezha-2022.04+git20220405.7446a472/debian/patches/0006-configs-Add-CONFIG_OF_BOARD_PLATFORM-as-default-for-.patch 1970-01-01 01:00:00.000000000 +0100 +++ u-boot-nezha-2022.04+git20220405.7446a472/debian/patches/0006-configs-Add-CONFIG_OF_BOARD_PLATFORM-as-default-for-.patch 2022-11-16 18:05:01.000000000 +0100 @@ -0,0 +1,23 @@ +From 100ef2b974a6ae4830d10404f6f55319e3f599bb Mon Sep 17 00:00:00 2001 +From: Alexandre Ghiti +Date: Fri, 29 Apr 2022 11:02:05 +0200 +Subject: [PATCH 1/2] configs: Add CONFIG_OF_BOARD_PLATFORM as default for dtb + fixup + +Signed-off-by: Alexandre Ghiti +--- + configs/lichee_rv_defconfig | 1 + + 1 file changed, 1 insertion(+) + +diff --git a/configs/lichee_rv_defconfig b/configs/lichee_rv_defconfig +index ad41d2c5fa..adf0de7891 100644 +--- a/configs/lichee_rv_defconfig ++++ b/configs/lichee_rv_defconfig +@@ -22,3 +22,4 @@ CONFIG_USB_MUSB_GADGET=y + CONFIG_USB_GADGET=y + CONFIG_USB_GADGET_DOWNLOAD=y + CONFIG_USB_FUNCTION_MASS_STORAGE=y ++CONFIG_OF_BOARD_SETUP=y +-- +2.32.0 + diff -Nru u-boot-nezha-2022.04+git20220405.7446a472/debian/patches/series u-boot-nezha-2022.04+git20220405.7446a472/debian/patches/series --- u-boot-nezha-2022.04+git20220405.7446a472/debian/patches/series 2022-04-21 11:19:39.000000000 +0200 +++ u-boot-nezha-2022.04+git20220405.7446a472/debian/patches/series 2022-11-16 18:05:01.000000000 +0100 @@ -4,3 +4,5 @@ 0003-watchdog-Disable-watchdog-by-default.patch 0004-configs-sunxi-Make-RISC-V-boards-use-ARM64-fdt-initr.patch 0005-board-configs-nezha-Fixup-kernel-dtb-with-the-memory.patch +0006-configs-Add-CONFIG_OF_BOARD_PLATFORM-as-default-for-.patch +update-isa-spec.patch diff -Nru u-boot-nezha-2022.04+git20220405.7446a472/debian/patches/update-isa-spec.patch u-boot-nezha-2022.04+git20220405.7446a472/debian/patches/update-isa-spec.patch --- u-boot-nezha-2022.04+git20220405.7446a472/debian/patches/update-isa-spec.patch 1970-01-01 01:00:00.000000000 +0100 +++ u-boot-nezha-2022.04+git20220405.7446a472/debian/patches/update-isa-spec.patch 2022-11-16 18:05:01.000000000 +0100 @@ -0,0 +1,17 @@ +Update to newer default ISA spec in GCC and binutils: + + https://lists.infradead.org/pipermail/linux-riscv/2022-January/011728.html + +diff --git a/arch/riscv/Makefile b/arch/riscv/Makefile +index 0b80eb8d86..7814d02bbd 100644 +--- a/arch/riscv/Makefile ++++ b/arch/riscv/Makefile +@@ -24,7 +24,7 @@ ifeq ($(CONFIG_CMODEL_MEDANY),y) + CMODEL = medany + endif + +-ARCH_FLAGS = -march=$(ARCH_BASE)$(ARCH_A)$(ARCH_C) -mabi=$(ABI) \ ++ARCH_FLAGS = -march=$(ARCH_BASE)$(ARCH_A)$(ARCH_C)_zicsr_zifencei -mabi=$(ABI) \ + -mcmodel=$(CMODEL) + + PLATFORM_CPPFLAGS += $(ARCH_FLAGS) diff -Nru u-boot-nezha-2022.04+git20220405.7446a472/debian/postinst u-boot-nezha-2022.04+git20220405.7446a472/debian/postinst --- u-boot-nezha-2022.04+git20220405.7446a472/debian/postinst 2022-04-21 11:19:39.000000000 +0200 +++ u-boot-nezha-2022.04+git20220405.7446a472/debian/postinst 2022-11-16 18:05:01.000000000 +0100 @@ -9,6 +9,10 @@ if grep -q '^Allwinner D1 Nezha$' /sys/firmware/devicetree/base/model && [ -e /dev/disk/by-partlabel/loader2 ]; then dd if=/usr/lib/u-boot/nezha/u-boot.toc1 of=/dev/disk/by-partlabel/loader2 conv=fsync fi + # Do not match the end of line so that this works for the single board, dock and panel. + if grep -q '^Sipeed Lichee RV' /sys/firmware/devicetree/base/model && [ -e /dev/disk/by-partlabel/loader2 ]; then + dd if=/usr/lib/u-boot/licheerv/u-boot.toc1 of=/dev/disk/by-partlabel/loader2 conv=fsync + fi ;; esac diff -Nru u-boot-nezha-2022.04+git20220405.7446a472/debian/README.Debian u-boot-nezha-2022.04+git20220405.7446a472/debian/README.Debian --- u-boot-nezha-2022.04+git20220405.7446a472/debian/README.Debian 2022-04-21 11:19:39.000000000 +0200 +++ u-boot-nezha-2022.04+git20220405.7446a472/debian/README.Debian 2022-11-16 18:05:01.000000000 +0100 @@ -1,16 +1,16 @@ -The boot0 SPL used by the Nezha board expects to load a TOC1 image containing -OpenSBI, U-Boot, and a DTB from sector 32800. If loading fails, it tries -to read a backup from sector 24576. +The boot0 SPL used by the Nezha and the LicheeRV boards expects to load a TOC1 +image containing OpenSBI, U-Boot, and a DTB from sector 32800. If loading fails, +it tries to read a backup from sector 24576. To install to the first position use: - sudo dd if=/usr/lib/u-boot/nezha/u-boot.toc1 of=/dev/sdX bs=8192 seek=2050 \ - conv=fsync,notrunc + sudo dd if=/usr/lib/u-boot/[nezha|licheerv]/u-boot.toc1 of=/dev/sdX bs=8192 \ + seek=2050 conv=fsync,notrunc To install to the backup position use: - sudo dd if=/usr/lib/u-boot/nezha/u-boot.toc1 of=/dev/sdX bs=8192 seek=1536 \ - conv=fsync,notrunc + sudo dd if=/usr/lib/u-boot/[nezha|licheerv]/u-boot.toc1 of=/dev/sdX bs=8192 \ + seek=1536 conv=fsync,notrunc Also worth mentioning: currently this package is based on a forked version of the original fork for u-boot allwinner, mainly because the required commit that diff -Nru u-boot-nezha-2022.04+git20220405.7446a472/debian/rules u-boot-nezha-2022.04+git20220405.7446a472/debian/rules --- u-boot-nezha-2022.04+git20220405.7446a472/debian/rules 2022-04-21 11:19:39.000000000 +0200 +++ u-boot-nezha-2022.04+git20220405.7446a472/debian/rules 2022-11-16 18:05:01.000000000 +0100 @@ -16,17 +16,22 @@ dh_gencontrol -- $(dpkg-gencontrol_args) override_dh_auto_build: + # Nezha + make nezha_defconfig O=build_nezha OPENSBI=/usr/lib/riscv64-linux-gnu/opensbi/generic/fw_dynamic.bin \ CROSS_COMPILE=riscv64-linux-gnu- \ - make V=$(VERBOSE) - tools/mkimage -T sunxi_toc1 -d toc1.cfg u-boot.toc1 + make V=$(VERBOSE) O=build_nezha + cd build_nezha && ./tools/mkimage -T sunxi_toc1 -d ../toc1.cfg u-boot.toc1 + # LicheeRV + make lichee_rv_defconfig O=build_licheerv + OPENSBI=/usr/lib/riscv64-linux-gnu/opensbi/generic/fw_dynamic.bin \ + CROSS_COMPILE=riscv64-linux-gnu- \ + make V=$(VERBOSE) O=build_licheerv + cd build_licheerv && ./tools/mkimage -T sunxi_toc1 -d ../toc1.cfg u-boot.toc1 override_dh_auto_clean: make mrproper -override_dh_auto_configure: - make nezha_defconfig - override_dh_auto_test: override_dh_strip: