From 42089e3f532b8bfc517949d9414395d1d36beb49 Mon Sep 17 00:00:00 2001 From: Marco Felsch Date: Wed, 5 Oct 2022 13:12:13 +0200 Subject: RISC-V: squash 64bit defconfigs into rv64i_defconfig This commit squashes all 64bit risc-v defconfigs into one like armv8. The 32bit defconfigs are not changed since those systems have tight resource constraints and a generic defconfig may break some systems. Signed-off-by: Marco Felsch Link: https://lore.barebox.org/20221005111214.148844-6-m.felsch@pengutronix.de Signed-off-by: Sascha Hauer --- Documentation/boards/emulated.rst | 4 ++-- Documentation/boards/riscv.rst | 6 +++--- 2 files changed, 5 insertions(+), 5 deletions(-) (limited to 'Documentation') diff --git a/Documentation/boards/emulated.rst b/Documentation/boards/emulated.rst index 584883d6ef..ef035ec69a 100644 --- a/Documentation/boards/emulated.rst +++ b/Documentation/boards/emulated.rst @@ -64,12 +64,12 @@ The script can also be used with a precompiled barebox tree:: ``emulate.pl`` also has some knowledge on paravirtualized devices:: # Run target and pass a block device (here /dev/virtioblk0) - ARCH=riscv ./test/emulate.pl --blk=rootfs.ext4 virt64_defconfig + ARCH=riscv ./test/emulate.pl --blk=rootfs.ext4 rv64i_defconfig Needed command line options can be passed directly to the emulator/``pytest`` as well by placing them behind ``--``:: # appends -device ? to the command line. Add -n to see the final result - ARCH=riscv ./test/emulate.pl virt64_defconfig -- -device ? + ARCH=riscv ./test/emulate.pl rv64i_defconfig -- -device ? For a complete listing of options run ``./test/emulate.pl -h``. diff --git a/Documentation/boards/riscv.rst b/Documentation/boards/riscv.rst index b7a3a95f0f..e69eca78c8 100644 --- a/Documentation/boards/riscv.rst +++ b/Documentation/boards/riscv.rst @@ -6,10 +6,10 @@ QEMU Virt barebox supports both the qemu riscv32 and riscv64 ``-M virt`` boards:: - make ARCH=riscv virt64_defconfig + make ARCH=riscv rv64i_defconfig qemu-system-riscv64 -M virt -serial stdio -kernel build/images/barebox-dt-2nd.img -Replace ``64`` by ``32`` for 32-bit build. :ref:`virtio_sect` over MMIO is supported and +For 32-bit builds use ``virt32_defconfig``. :ref:`virtio_sect` over MMIO is supported and can be used for e.g. an extra console or to pass in a virtio-blk device:: qemu-system-riscv64 -M virt -serial stdio \ @@ -65,7 +65,7 @@ BeagleV barebox has second-stage support for the BeagleV Starlight:: - make ARCH=riscv starfive_defconfig + make ARCH=riscv rv64i_defconfig make Thie resulting ``./images/barebox-beaglev-starlight.img`` can be used as payload -- cgit v1.2.1 From d2c655d34cb204c5ba56891b4e597d53330de4d8 Mon Sep 17 00:00:00 2001 From: Marco Felsch Date: Wed, 5 Oct 2022 13:12:14 +0200 Subject: RISC-V: add Allwinner Sun20i D1 Nezha support Add Allwinner sun20i SoC and D1-Nezha board support. Signed-off-by: Marco Felsch Link: https://lore.barebox.org/20221005111214.148844-7-m.felsch@pengutronix.de Signed-off-by: Sascha Hauer --- Documentation/boards/riscv.rst | 102 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 102 insertions(+) (limited to 'Documentation') diff --git a/Documentation/boards/riscv.rst b/Documentation/boards/riscv.rst index e69eca78c8..92f663cfb9 100644 --- a/Documentation/boards/riscv.rst +++ b/Documentation/boards/riscv.rst @@ -188,3 +188,105 @@ Next, start barebox from DRAM:: running /env/bin/init... /env/bin/init not found barebox:/ + +Allwinner D1 Nezha +------------------ + +Barebox has limited second-stage support for the Allwinner D1 Nezha (sun20i):: + + ARCH=riscv make rv64i_defconfig + ARCH=riscv CROSS_COMPILE=riscv64-linux-gnu- make + +The resulting ``./images/barebox-allwinner-d1.img`` can be used as 2nd stage +image which gets called by opensbi:: + + git clone https://github.com/tekkamanninja/opensbi -b allwinner_d1 + cd opensbi + CROSS_COMPILE=riscv64-linux-gnu- PLATFORM=generic FW_PIC=y make + +The resulting ``./build/platform/generic/firmware/fw_dynamic.bin`` is loaded +by the 1st stage (spl) loader, which is basically a u-boot spl:: + + git clone https://github.com/smaeul/sun20i_d1_spl -b mainline + cd sun20i_d1_spl + CROSS_COMPILE=riscv64-linux-gnu- make p=sun20iw1p1 mmc + +The resulting ``./nboot/boot0_sdcard_sun20iw1p1.bin`` image used as 1st stage +bootloader which loads all necessary binaries: dtb, opensbi and barebox to the +dedicated places in DRAM. After loading it jumps to the opensbi image. The +initial dtb can be taken from u-boot:: + + git clone https://github.com/smaeul/u-boot.git -b d1-wip + cd u-boot + ARCH=riscv make nezha_defconfig + ARCH=riscv CROSS_COMPILE=riscv64-linux-gnu- make + +Make will print two warnings at the end of this command but those can be ignored +since we only want the devicetree blob which can be found under ``./u-boot.dtb``. + +The final image is build by mkimage. It is some sort of a self-defined toc1 +format. So we need to compile the mkimage with the toc1 format support as +first:: + + cd u-boot + make tools-only + +The resulting ``tools/mkimage`` is used to build the toc1 image which is loaded +by the 1st stage bootloader from the mmc interface. To build the final toc1 image +we need to specify a toc1.cfg like:: + + [opensbi] + file = /opensbi/build/platform/generic/firmware/fw_dynamic.bin + addr = 0x40000000 + [dtb] + file = /u-boot/u-boot.dtb + addr = 0x44000000 + [u-boot] + file = /barebox/images/barebox-allwinner-d1.img + addr = 0x4a000000 + +Then we need to call:: + + mkimage -T sunxi_toc1 -d toc1.cfg boot.toc1 + +The last part is to place the 1st stage bootloader and the ``boot.toc1`` image +onto the correct places. So the ROM loader can find the 1st stage bootloader +and the 1st bootloader can find the ``boot.toc1`` image. This is done by:: + + dd if=boot0_sdcard_sun20iw1p1.bin of=/dev/sd bs=512 seek=16 + dd if=boot.toc1 of=/dev/sd bs=512 seek=32800 + +Now plug in the sdcard and power device and you will see:: + + [309]HELLO! BOOT0 is starting! + [312]BOOT0 commit : 882671f-dirty + [315]set pll start + [317]periph0 has been enabled + [320]set pll end + [322]board init ok + + ... + + OpenSBI v0.9-204-gc9024b5 + ____ _____ ____ _____ + / __ \ / ____| _ \_ _| + | | | |_ __ ___ _ __ | (___ | |_) || | + | | | | '_ \ / _ \ '_ \ \___ \| _ < | | + | |__| | |_) | __/ | | |____) | |_) || |_ + \____/| .__/ \___|_| |_|_____/|____/_____| + | | + |_| + + Platform Name : Allwinner D1 Nezha + Platform Features : medeleg + + ... + + barebox 2022.08.0-00262-g38678340903b #1 Tue Sep 13 12:54:29 CEST 2022 + + + Board: Allwinner D1 Nezha + + ... + + barebox@Allwinner D1 Nezha:/ -- cgit v1.2.1