From patchwork Tue Oct 4 08:12:59 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Angelo Compagnucci X-Patchwork-Id: 1685801 Return-Path: X-Original-To: incoming-buildroot@patchwork.ozlabs.org Delivered-To: patchwork-incoming-buildroot@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=buildroot.org (client-ip=140.211.166.138; helo=smtp1.osuosl.org; envelope-from=buildroot-bounces@buildroot.org; receiver=) Received: from smtp1.osuosl.org (smtp1.osuosl.org [140.211.166.138]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-384) server-digest SHA384) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4MhVnn0ZGvz1yqn for ; Tue, 4 Oct 2022 19:13:16 +1100 (AEDT) Received: from localhost (localhost [127.0.0.1]) by smtp1.osuosl.org (Postfix) with ESMTP id 99A3E82977; Tue, 4 Oct 2022 08:13:12 +0000 (UTC) DKIM-Filter: OpenDKIM Filter v2.11.0 smtp1.osuosl.org 99A3E82977 X-Virus-Scanned: amavisd-new at osuosl.org Received: from smtp1.osuosl.org ([127.0.0.1]) by localhost (smtp1.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id nGT64dhBiLVz; Tue, 4 Oct 2022 08:13:11 +0000 (UTC) Received: from ash.osuosl.org (ash.osuosl.org [140.211.166.34]) by smtp1.osuosl.org (Postfix) with ESMTP id 79D978267F; Tue, 4 Oct 2022 08:13:10 +0000 (UTC) DKIM-Filter: OpenDKIM Filter v2.11.0 smtp1.osuosl.org 79D978267F X-Original-To: buildroot@lists.busybox.net Delivered-To: buildroot@osuosl.org Received: from smtp1.osuosl.org (smtp1.osuosl.org [140.211.166.138]) by ash.osuosl.org (Postfix) with ESMTP id 444CC1BF288 for ; Tue, 4 Oct 2022 08:13:08 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by smtp1.osuosl.org (Postfix) with ESMTP id 18A108267F for ; Tue, 4 Oct 2022 08:13:08 +0000 (UTC) DKIM-Filter: OpenDKIM Filter v2.11.0 smtp1.osuosl.org 18A108267F X-Virus-Scanned: amavisd-new at osuosl.org Received: from smtp1.osuosl.org ([127.0.0.1]) by localhost (smtp1.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id TUmxJqgq5wUQ for ; Tue, 4 Oct 2022 08:13:05 +0000 (UTC) X-Greylist: whitelisted by SQLgrey-1.8.0 DKIM-Filter: OpenDKIM Filter v2.11.0 smtp1.osuosl.org B790B8266D Received: from mail-ed1-x534.google.com (mail-ed1-x534.google.com [IPv6:2a00:1450:4864:20::534]) by smtp1.osuosl.org (Postfix) with ESMTPS id B790B8266D for ; Tue, 4 Oct 2022 08:13:04 +0000 (UTC) Received: by mail-ed1-x534.google.com with SMTP id a13so17820318edj.0 for ; Tue, 04 Oct 2022 01:13:04 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date; bh=j/IQfRUBL+M9N6e6e89gCdq8wZM0z2OTLT66GHER9IY=; b=Q6py5g/JxA+QvRk7m6owfLeeeKDWl/P8nJp6q3E6d4b3h6mb4Ohyyjxj0QW79Z86SB zBJ+0v+BhLOFi4SIQvCQBHeg0UDP/uQJKV0XWao52k/J5x9bzU7Fk+Hw3h35BiBzQ/Ky wXW5f42JFMNB0nKtwqYctcHKJKwzFPcjMTnv6cVFhGn/ZJge04mS5+Q0LrdrcUGrX6Td kWbFt7Ukfbb11gy8fJy1eizON59P3ATWL5+08WWucKt9spqjoNYWiIxgKN2RXpOkRYQw WhV33KIy/YSm7JN17ivlWOeEJTqc+qZMzSnV5kxvgNczL2/fIF4uXm7y7yRlky+9D231 G7Bw== X-Gm-Message-State: ACrzQf1En6pZW8INelIJc3+S++2BNCpO9G/LMCOBLtLzgkoegv0jFYmQ hy+FALihOX5InWzlqUPTJu/bE91eFuCkog== X-Google-Smtp-Source: AMsMyM4NSxv2ULsxkj1VTKvLE3MKsofkcKBlTmg87s3oSQqwNi4lA0QQ0G70SaC4tbJUrz8MeaSzLA== X-Received: by 2002:a05:6402:528a:b0:454:8613:6560 with SMTP id en10-20020a056402528a00b0045486136560mr23193591edb.252.1664871182871; Tue, 04 Oct 2022 01:13:02 -0700 (PDT) Received: from angeloc.amarulasolutions.com (host085115199111.static.fidoka.tech. [85.115.199.111]) by smtp.gmail.com with ESMTPSA id v8-20020a50a448000000b00458d744898asm1166207edb.79.2022.10.04.01.13.01 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 04 Oct 2022 01:13:02 -0700 (PDT) From: Angelo Compagnucci To: buildroot@buildroot.org Date: Tue, 4 Oct 2022 10:12:59 +0200 Message-Id: <20221004081259.3728426-1-angelo@amarulasolutions.com> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 X-Mailman-Original-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amarulasolutions.com; s=google; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date; bh=j/IQfRUBL+M9N6e6e89gCdq8wZM0z2OTLT66GHER9IY=; b=BAa40Vedvv+q4eJvm8Czg3fjAo0uf6hTwojXo4sNqgrB9W19kE8iE/hFp0M+KlgEYX BFH01wlc5NNB1J9evGRLCowvWjG3cZiup/HodiElmnzSXvMj0gHFTpyJaeKf3V+f8ebE xSr/JJYCMJj6ALj9DNBYCTuLeBukbXlln/RV4= X-Mailman-Original-Authentication-Results: smtp1.osuosl.org; dkim=pass (1024-bit key) header.d=amarulasolutions.com header.i=@amarulasolutions.com header.a=rsa-sha256 header.s=google header.b=BAa40Ved Subject: [Buildroot] [PATCH] configs/lichee_rv: new defconfig X-BeenThere: buildroot@buildroot.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Discussion and development of buildroot List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Angelo Compagnucci Errors-To: buildroot-bounces@buildroot.org Sender: "buildroot" Lichee RV - Nezha CM is a compute module with modular design, equipped with Allwinner D1 chip (based on T-Head XuanTie C906 core), 512MB DDR3 RAM. Board support is based on the nezha defconfig already available in buildroot. https://wiki.sipeed.com/hardware/en/lichee/RV/RV.html https://linux-sunxi.org/Sipeed_Lichee_RV Signed-off-by: Angelo Compagnucci --- board/lichee_rv/genimage.cfg | 37 +++++++++++++ ...t-building-u-boot.toc1-for-lichee-rv.patch | 54 +++++++++++++++++++ board/lichee_rv/readme.txt | 26 +++++++++ configs/lichee_rv_defconfig | 34 ++++++++++++ 4 files changed, 151 insertions(+) create mode 100644 board/lichee_rv/genimage.cfg create mode 100644 board/lichee_rv/patches_rv/uboot/0002-Makefile-HACK-Support-building-u-boot.toc1-for-lichee-rv.patch create mode 100644 board/lichee_rv/readme.txt create mode 100644 configs/lichee_rv_defconfig diff --git a/board/lichee_rv/genimage.cfg b/board/lichee_rv/genimage.cfg new file mode 100644 index 0000000000..783391fb99 --- /dev/null +++ b/board/lichee_rv/genimage.cfg @@ -0,0 +1,37 @@ +# Minimal SD card image for the Allwinner Nezha + +image sdcard.img { + hdimage { + } + + partition boot0-1 { + in-partition-table = "no" + image = "boot0_sdcard_sun20iw1p1.bin" + offset = 8K + } + + partition boot0-2 { + in-partition-table = "no" + image = "boot0_sdcard_sun20iw1p1.bin" + offset = 128K + } + + partition u-boot-1 { + in-partition-table = "no" + image = "u-boot.toc1" + offset = 12M + } + + partition u-boot-2 { + in-partition-table = "no" + image = "u-boot.toc1" + offset = 16400K + } + + partition rootfs { + partition-type = 0x83 + image = "rootfs.ext4" + bootable = "true" + offset = 18M + } +} diff --git a/board/lichee_rv/patches_rv/uboot/0002-Makefile-HACK-Support-building-u-boot.toc1-for-lichee-rv.patch b/board/lichee_rv/patches_rv/uboot/0002-Makefile-HACK-Support-building-u-boot.toc1-for-lichee-rv.patch new file mode 100644 index 0000000000..69ebe3b21d --- /dev/null +++ b/board/lichee_rv/patches_rv/uboot/0002-Makefile-HACK-Support-building-u-boot.toc1-for-lichee-rv.patch @@ -0,0 +1,54 @@ +From 4a923e0e4ef6d2b41cb89d658e269adada847573 Mon Sep 17 00:00:00 2001 +From: Peter Korsgaard +Date: Thu, 4 Nov 2021 22:32:04 +0100 +Subject: [PATCH] Makefile: HACK: Support building u-boot.toc1 for nezda board + +For easier integration into Buildroot. The boot0 / toc1 logic is WIP until +U-Boot gains SPL support for the D1, so add a hack to make it easier to +integrate in Buildroot as-is. + +Signed-off-by: Peter Korsgaard +--- + Makefile | 9 +++++++++ + nezha.cfg | 9 +++++++++ + 2 files changed, 18 insertions(+) + create mode 100644 nezha.cfg + +diff --git a/Makefile b/Makefile +index f911f70344..259d93bf80 100644 +--- a/Makefile ++++ b/Makefile +@@ -1084,6 +1084,15 @@ endif + .binman_stamp: FORCE + @touch $@ + ++fw_dynamic.bin: $(OPENSBI) ++ $(call if_changed,copy) ++ ++MKIMAGEFLAGS_u-boot.toc1 = -T sunxi_toc1 ++u-boot.toc1: lichee-rv.cfg fw_dynamic.bin inputs ++ $(call if_changed,mkimage) ++ ++all: u-boot.toc1 ++ + ifeq ($(CONFIG_DEPRECATED),y) + $(warning "You have deprecated configuration options enabled in your .config! Please check your configuration.") + endif +diff --git a/lichee-rv.cfg b/lichee-rv.cfg +new file mode 100644 +index 0000000000..2d23b9b388 +--- /dev/null ++++ b/lichee-rv.cfg +@@ -0,0 +1,9 @@ ++[opensbi] ++file = fw_dynamic.bin ++addr = 0x40000000 ++[dtb] ++file = arch/riscv/dts/sun20i-d1-lichee-rv.dtb ++addr = 0x44000000 ++[u-boot] ++file = u-boot-nodtb.bin ++addr = 0x4a000000 +-- +2.20.1 + diff --git a/board/lichee_rv/readme.txt b/board/lichee_rv/readme.txt new file mode 100644 index 0000000000..008be3a3bc --- /dev/null +++ b/board/lichee_rv/readme.txt @@ -0,0 +1,26 @@ +Lichee RV +=============== + +Lichee RV - Nezha CM is a compute module with modular design, equipped +with Allwinner D1 chip (based on T-Head XuanTie C906 core), 512MB DDR3 RAM. +It can boot from TF card or SD-NAND, uses two sets of M.2 b key 67 pin +connectors to route all IO, making it convient for wide use and easy to replace. + +How to build +============ + +$ make lichee_rv_defconfig +$ make + +How to write the SD card +======================== + +Once the build process is finished you will have an image called "sdcard.img" +in the output/images/ directory. + +Copy the bootable "sdcard.img" onto an SD card with "dd": + + $ sudo dd if=output/images/sdcard.img of=/dev/sdX + +Connect a TTL UART to the debug connector, insert the microSD card and +plug in a USB-C cable to the PWR connector to boot the system. diff --git a/configs/lichee_rv_defconfig b/configs/lichee_rv_defconfig new file mode 100644 index 0000000000..8befcd564b --- /dev/null +++ b/configs/lichee_rv_defconfig @@ -0,0 +1,34 @@ +BR2_riscv=y +BR2_GLOBAL_PATCH_DIR="board/lichee_rv/patches_rv" +BR2_ROOTFS_OVERLAY="board/nezha/overlay" +BR2_ROOTFS_POST_IMAGE_SCRIPT="support/scripts/genimage.sh" +BR2_ROOTFS_POST_SCRIPT_ARGS="-c board/lichee_rv/genimage.cfg" +BR2_LINUX_KERNEL=y +BR2_LINUX_KERNEL_CUSTOM_TARBALL=y +BR2_LINUX_KERNEL_CUSTOM_TARBALL_LOCATION="$(call github,smaeul,linux,f4bce410a6b47606557cb0d291572afc4c240c85)/linux-f4bce410a6b47606557cb0d291572afc4c240c85.tar.gz" +BR2_LINUX_KERNEL_DEFCONFIG="nezha" +BR2_LINUX_KERNEL_DTS_SUPPORT=y +BR2_LINUX_KERNEL_INTREE_DTS_NAME="allwinner/sun20i-d1-lichee-rv" +BR2_LINUX_KERNEL_INSTALL_TARGET=y +BR2_TARGET_ROOTFS_EXT2=y +BR2_TARGET_ROOTFS_EXT2_4=y +# BR2_TARGET_ROOTFS_TAR is not set +BR2_TARGET_OPENSBI=y +BR2_TARGET_OPENSBI_CUSTOM_TARBALL=y +BR2_TARGET_OPENSBI_CUSTOM_TARBALL_LOCATION="$(call github,smaeul,opensbi,4bcaf9aa1dbc69ccb68998c7d462ef895163d493)/opensbi-4bcaf9aa1dbc69ccb68998c7d462ef895163d493.tar.gz" +BR2_TARGET_OPENSBI_PLAT="generic" +# BR2_TARGET_OPENSBI_INSTALL_JUMP_IMG is not set +BR2_TARGET_SUN20I_D1_SPL=y +BR2_TARGET_UBOOT=y +BR2_TARGET_UBOOT_BUILD_SYSTEM_KCONFIG=y +BR2_TARGET_UBOOT_CUSTOM_TARBALL=y +BR2_TARGET_UBOOT_CUSTOM_TARBALL_LOCATION="$(call github,smaeul,u-boot,7446a47204fd8923b99ced0091667979c4fd27fa)/uboot-7446a47204fd8923b99ced0091667979c4fd27fa.tar.gz" +BR2_TARGET_UBOOT_BOARD_DEFCONFIG="lichee_rv" +BR2_TARGET_UBOOT_NEEDS_DTC=y +BR2_TARGET_UBOOT_NEEDS_PYLIBFDT=y +BR2_TARGET_UBOOT_NEEDS_OPENSSL=y +BR2_TARGET_UBOOT_NEEDS_OPENSBI=y +# BR2_TARGET_UBOOT_FORMAT_BIN is not set +BR2_TARGET_UBOOT_FORMAT_CUSTOM=y +BR2_TARGET_UBOOT_FORMAT_CUSTOM_NAME="u-boot.toc1" +BR2_PACKAGE_HOST_GENIMAGE=y