All of lore.kernel.org
 help / color / mirror / Atom feed
* [Buildroot] [PATCH v3] board: Add support for terasic DE10 Nano
@ 2021-07-21 12:59 Gwenhael Goavec-Merou
  2021-07-25 14:08 ` Thomas Petazzoni
  0 siblings, 1 reply; 5+ messages in thread
From: Gwenhael Goavec-Merou @ 2021-07-21 12:59 UTC (permalink / raw)
  To: buildroot; +Cc: Gwenhael Goavec-Merou

[-- Attachment #1: Type: text/plain, Size: 7228 bytes --]

From: Gwenhael Goavec-Merou <gwenhael.goavec-merou@trabucayre.com>

Terasic DE10 Nano is an SoCFPGA cycloneV based board.
References:
- https://www.terasic.com.tw/cgi-bin/page/archive.pl?Language=English&CategoryNo=205&No=1046
- https://rocketboards.org/foswiki/Documentation/DE10NanoDevelopmentBoard

Note: there is no dts in kernel (mainline or intel), but since DE0 Nano Soc is
similar, the corresponding dts is usually used

Signed-off-by: Gwenhael Goavec-Merou <gwenhael.goavec-merou@trabucayre.com>
---
Changes v2 -> v3:
- use barebox default version: v2021.07.0 is now released with DE10 Nano support
Changes v1 -> v2:
- add defconfig and board path in DEVELOPERS
---
 DEVELOPERS                                    |  2 +
 .../de10nano_cyclone5/barebox-env/boot/mmc    |  8 +++
 .../barebox-env/init/automount                |  5 ++
 .../barebox-env/nv/boot.default               |  1 +
 .../barebox-env/nv/linux.bootargs.console     |  1 +
 board/terasic/de10nano_cyclone5/genimage.cfg  | 57 +++++++++++++++++++
 board/terasic/de10nano_cyclone5/readme.txt    | 42 ++++++++++++++
 configs/terasic_de10nano_cyclone5_defconfig   | 28 +++++++++
 8 files changed, 144 insertions(+)
 create mode 100644 board/terasic/de10nano_cyclone5/barebox-env/boot/mmc
 create mode 100644 board/terasic/de10nano_cyclone5/barebox-env/init/automount
 create mode 100644 board/terasic/de10nano_cyclone5/barebox-env/nv/boot.default
 create mode 100644 board/terasic/de10nano_cyclone5/barebox-env/nv/linux.bootargs.console
 create mode 100644 board/terasic/de10nano_cyclone5/genimage.cfg
 create mode 100644 board/terasic/de10nano_cyclone5/readme.txt
 create mode 100644 configs/terasic_de10nano_cyclone5_defconfig

diff --git a/DEVELOPERS b/DEVELOPERS
index e77ceb2a95..a9f4fe1986 100644
--- a/DEVELOPERS
+++ b/DEVELOPERS
@@ -1105,6 +1105,8 @@ F:	configs/arm_juno_defconfig
 F:	board/arm/juno/
 
 N:	Gwenhael Goavec-Merou <gwenhael.goavec-merou@trabucayre.com>
+F:	board/terasic/de10nano_cyclone5/
+F:	configs/terasic_de10nano_cyclone5_defconfig
 F:	package/gnuradio/
 F:	package/gqrx/
 F:	package/gr-osmosdr/
diff --git a/board/terasic/de10nano_cyclone5/barebox-env/boot/mmc b/board/terasic/de10nano_cyclone5/barebox-env/boot/mmc
new file mode 100644
index 0000000000..fed2b0b45d
--- /dev/null
+++ b/board/terasic/de10nano_cyclone5/barebox-env/boot/mmc
@@ -0,0 +1,8 @@
+#!/bin/sh
+
+global.bootm.oftree="/boot/socfpga_cyclone5_de0_nano_soc.dtb"
+global.bootm.image="/boot/zImage"
+
+#bootargs-ip
+
+global.linux.bootargs.dyn.root="root=/dev/mmcblk0p3 rw rootwait"
diff --git a/board/terasic/de10nano_cyclone5/barebox-env/init/automount b/board/terasic/de10nano_cyclone5/barebox-env/init/automount
new file mode 100644
index 0000000000..4092ecbaec
--- /dev/null
+++ b/board/terasic/de10nano_cyclone5/barebox-env/init/automount
@@ -0,0 +1,5 @@
+#!/bin/sh
+
+# SD card slot, first partition
+mkdir -p /mnt/mmcblk0p2
+automount -d /mnt/mmcblk0p2 'mount /dev/mmc0.1 /mnt/mmcblk0p2'
diff --git a/board/terasic/de10nano_cyclone5/barebox-env/nv/boot.default b/board/terasic/de10nano_cyclone5/barebox-env/nv/boot.default
new file mode 100644
index 0000000000..61f529d69a
--- /dev/null
+++ b/board/terasic/de10nano_cyclone5/barebox-env/nv/boot.default
@@ -0,0 +1 @@
+mmc
diff --git a/board/terasic/de10nano_cyclone5/barebox-env/nv/linux.bootargs.console b/board/terasic/de10nano_cyclone5/barebox-env/nv/linux.bootargs.console
new file mode 100644
index 0000000000..476b1fbe49
--- /dev/null
+++ b/board/terasic/de10nano_cyclone5/barebox-env/nv/linux.bootargs.console
@@ -0,0 +1 @@
+console=ttyS0,115200
diff --git a/board/terasic/de10nano_cyclone5/genimage.cfg b/board/terasic/de10nano_cyclone5/genimage.cfg
new file mode 100644
index 0000000000..3261c62741
--- /dev/null
+++ b/board/terasic/de10nano_cyclone5/genimage.cfg
@@ -0,0 +1,57 @@
+image boot.vfat {
+	vfat {
+		file zImage {
+            image = "zImage"
+        }
+
+        file socfpga_cyclone5_de0_nano_soc.dtb {
+            image = "socfpga_cyclone5_de0_nano_soc.dtb"
+        }
+
+        file barebox.bin {
+            image = "barebox-socfpga-de10_nano.img"
+        }
+
+        file barebox.env {
+            image = "barebox-env"
+        }
+	}
+	size = 8M
+}
+
+image boot.img {
+	hdimage {
+		partition-table = "no"
+	}
+
+	partition spl {
+		in-partition-table = "no"
+		image = "barebox-socfpga-de10_nano-xload.img"
+		offset = 0
+		size = 64k
+	}
+
+	size = 1M
+}
+
+image sdcard.img {
+	hdimage {
+	}
+
+	partition spl {
+		partition-type = 0xa2
+		image = "boot.img"
+	}
+
+	partition boot {
+		partition-type = 0xc
+		bootable = "true"
+		image = "boot.vfat"
+	}
+
+	partition rootfs {
+		partition-type = 0x83
+		image = "rootfs.ext2"
+		size = 500M
+	}
+}
diff --git a/board/terasic/de10nano_cyclone5/readme.txt b/board/terasic/de10nano_cyclone5/readme.txt
new file mode 100644
index 0000000000..c5aafef320
--- /dev/null
+++ b/board/terasic/de10nano_cyclone5/readme.txt
@@ -0,0 +1,42 @@
+Terasic DE10 Nano Development Board
+
+Intro
+=====
+
+More information about this board can be found here:
+https://rocketboards.org/foswiki/Documentation/DE10NanoDevelopmentBoard
+
+Build
+=====
+
+First, load socrates config for buildroot
+
+    make terasic_de10nano_cyclone5_defconfig
+
+Build everything
+
+    make
+
+Following files will be generated in output/images
+
+.
+├── barebox-env
+├── barebox-socfpga-de10_nano.img
+├── barebox-socfpga-de10_nano-xload.img
+├── boot.img
+├── boot.vfat
+├── rootfs.ext2
+├── rootfs.ext4 -> rootfs.ext2
+├── rootfs.tar
+├── sdcard.img
+├── socfpga_cyclone5_de0_nano_soc.dtb
+└── zImage
+
+Creating bootable SD card
+=========================
+
+Simply invoke
+
+dd if=output/images/sdcard.img of=/dev/sdX
+
+Where X is your SD card device (not partition)
diff --git a/configs/terasic_de10nano_cyclone5_defconfig b/configs/terasic_de10nano_cyclone5_defconfig
new file mode 100644
index 0000000000..4a356f31a8
--- /dev/null
+++ b/configs/terasic_de10nano_cyclone5_defconfig
@@ -0,0 +1,28 @@
+BR2_arm=y
+BR2_cortex_a9=y
+BR2_ARM_ENABLE_NEON=y
+BR2_ARM_ENABLE_VFP=y
+BR2_ARM_FPU_NEON=y
+BR2_KERNEL_HEADERS_5_11=y
+BR2_ROOTFS_POST_IMAGE_SCRIPT="support/scripts/genimage.sh"
+BR2_ROOTFS_POST_SCRIPT_ARGS="-c board/terasic/de10nano_cyclone5/genimage.cfg"
+BR2_LINUX_KERNEL=y
+BR2_LINUX_KERNEL_CUSTOM_GIT=y
+BR2_LINUX_KERNEL_CUSTOM_REPO_URL="https://github.com/altera-opensource/linux-socfpga.git"
+BR2_LINUX_KERNEL_CUSTOM_REPO_VERSION="rel_socfpga-5.11_21.06.01_pr"
+BR2_LINUX_KERNEL_DEFCONFIG="socfpga"
+BR2_LINUX_KERNEL_DTS_SUPPORT=y
+BR2_LINUX_KERNEL_INTREE_DTS_NAME="socfpga_cyclone5_de0_nano_soc"
+BR2_TARGET_ROOTFS_EXT2=y
+BR2_TARGET_ROOTFS_EXT2_4=y
+BR2_TARGET_BAREBOX=y
+BR2_TARGET_BAREBOX_BOARD_DEFCONFIG="socfpga"
+BR2_TARGET_BAREBOX_IMAGE_FILE="images/barebox-socfpga-de10_nano.img"
+BR2_TARGET_BAREBOX_CUSTOM_ENV=y
+BR2_TARGET_BAREBOX_CUSTOM_ENV_PATH="board/terasic/de10nano_cyclone5/barebox-env"
+BR2_TARGET_BAREBOX_AUX=y
+BR2_TARGET_BAREBOX_AUX_BOARD_DEFCONFIG="socfpga-xload-2"
+BR2_TARGET_BAREBOX_AUX_IMAGE_FILE="images/barebox-socfpga-de10_nano-xload.img"
+BR2_PACKAGE_HOST_DOSFSTOOLS=y
+BR2_PACKAGE_HOST_GENIMAGE=y
+BR2_PACKAGE_HOST_MTOOLS=y
-- 
2.31.1


[-- Attachment #2: Type: text/plain, Size: 145 bytes --]

_______________________________________________
buildroot mailing list
buildroot@busybox.net
http://lists.busybox.net/mailman/listinfo/buildroot

^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [Buildroot] [PATCH v3] board: Add support for terasic DE10 Nano
  2021-07-21 12:59 [Buildroot] [PATCH v3] board: Add support for terasic DE10 Nano Gwenhael Goavec-Merou
@ 2021-07-25 14:08 ` Thomas Petazzoni
  2021-07-25 16:05   ` Gwenhael Goavec-Merou
  0 siblings, 1 reply; 5+ messages in thread
From: Thomas Petazzoni @ 2021-07-25 14:08 UTC (permalink / raw)
  To: Gwenhael Goavec-Merou; +Cc: Gwenhael Goavec-Merou, buildroot

Hello,

On Wed, 21 Jul 2021 14:59:08 +0200
Gwenhael Goavec-Merou <gwenj@trabucayre.com> wrote:

> From: Gwenhael Goavec-Merou <gwenhael.goavec-merou@trabucayre.com>
> 
> Terasic DE10 Nano is an SoCFPGA cycloneV based board.
> References:
> - https://www.terasic.com.tw/cgi-bin/page/archive.pl?Language=English&CategoryNo=205&No=1046
> - https://rocketboards.org/foswiki/Documentation/DE10NanoDevelopmentBoard
> 
> Note: there is no dts in kernel (mainline or intel), but since DE0 Nano Soc is
> similar, the corresponding dts is usually used
> 
> Signed-off-by: Gwenhael Goavec-Merou <gwenhael.goavec-merou@trabucayre.com>

Thanks for the patch. It looks mostly good, expect for a few details,
see below.

> diff --git a/board/terasic/de10nano_cyclone5/genimage.cfg b/board/terasic/de10nano_cyclone5/genimage.cfg
> new file mode 100644
> index 0000000000..3261c62741
> --- /dev/null
> +++ b/board/terasic/de10nano_cyclone5/genimage.cfg
> @@ -0,0 +1,57 @@
> +image boot.vfat {
> +	vfat {
> +		file zImage {
> +            image = "zImage"
> +        }

Starting from here the indentation is not correct.

> +
> +        file socfpga_cyclone5_de0_nano_soc.dtb {
> +            image = "socfpga_cyclone5_de0_nano_soc.dtb"
> +        }
> +
> +        file barebox.bin {
> +            image = "barebox-socfpga-de10_nano.img"
> +        }
> +
> +        file barebox.env {
> +            image = "barebox-env"
> +        }
> +	}
> +	size = 8M

Could you fix the indentation in this block ?

> +}
> +
> +image boot.img {
> +	hdimage {
> +		partition-table = "no"
> +	}
> +
> +	partition spl {
> +		in-partition-table = "no"
> +		image = "barebox-socfpga-de10_nano-xload.img"
> +		offset = 0
> +		size = 64k
> +	}
> +
> +	size = 1M
> +}

I don't understand why you have a boot.img, which apparently only
contains the raw contacts of this xload.img file. Why not use this
xload.img file directly...

> +
> +image sdcard.img {
> +	hdimage {
> +	}
> +
> +	partition spl {
> +		partition-type = 0xa2
> +		image = "boot.img"

.. here ?

Example from another genimage.cfg:

        partition spl {
                in-partition-table = "no"
                image = "sunxi-spl.bin"
                offset = 8192
        }

        partition u-boot {
                in-partition-table = "no"
                image = "u-boot.itb"
                offset = 40K
                size = 1M # 1MB - 40K
        }

> +	partition rootfs {
> +		partition-type = 0x83
> +		image = "rootfs.ext2"
> +		size = 500M

I'd suggest to not put a size here, and instead tweak the size of the
ext2 filesystem in the defconfig. Indeed, having a larger partition but
not a larger filesystem is kind of useless (or requires a resize of the
filesystem when booting).

> diff --git a/configs/terasic_de10nano_cyclone5_defconfig b/configs/terasic_de10nano_cyclone5_defconfig
> new file mode 100644
> index 0000000000..4a356f31a8
> --- /dev/null
> +++ b/configs/terasic_de10nano_cyclone5_defconfig
> @@ -0,0 +1,28 @@
> +BR2_arm=y
> +BR2_cortex_a9=y
> +BR2_ARM_ENABLE_NEON=y
> +BR2_ARM_ENABLE_VFP=y
> +BR2_ARM_FPU_NEON=y
> +BR2_KERNEL_HEADERS_5_11=y

Could you use:

BR2_PACKAGE_HOST_LINUX_HEADERS_CUSTOM_5_11=y

instead ?

Could you adjust those small details and send a v4?

Thanks a lot!

Thomas
-- 
Thomas Petazzoni, co-owner and CEO, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com
_______________________________________________
buildroot mailing list
buildroot@busybox.net
http://lists.busybox.net/mailman/listinfo/buildroot

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [Buildroot] [PATCH v3] board: Add support for terasic DE10 Nano
  2021-07-25 14:08 ` Thomas Petazzoni
@ 2021-07-25 16:05   ` Gwenhael Goavec-Merou
  2021-07-25 17:35     ` Thomas Petazzoni
  0 siblings, 1 reply; 5+ messages in thread
From: Gwenhael Goavec-Merou @ 2021-07-25 16:05 UTC (permalink / raw)
  To: Thomas Petazzoni; +Cc: Gwenhael Goavec-Merou, buildroot

Thomas, all,

On Sun, 25 Jul 2021 16:08:33 +0200
Thomas Petazzoni <thomas.petazzoni@bootlin.com> wrote:

> Hello,
> 
> On Wed, 21 Jul 2021 14:59:08 +0200
> Gwenhael Goavec-Merou <gwenj@trabucayre.com> wrote:
> 
> > From: Gwenhael Goavec-Merou <gwenhael.goavec-merou@trabucayre.com>
> > 
> > Terasic DE10 Nano is an SoCFPGA cycloneV based board.
> > References:
> > - https://www.terasic.com.tw/cgi-bin/page/archive.pl?Language=English&CategoryNo=205&No=1046
> > - https://rocketboards.org/foswiki/Documentation/DE10NanoDevelopmentBoard
> > 
> > Note: there is no dts in kernel (mainline or intel), but since DE0 Nano Soc is
> > similar, the corresponding dts is usually used
> > 
> > Signed-off-by: Gwenhael Goavec-Merou <gwenhael.goavec-merou@trabucayre.com>  
> 
> Thanks for the patch. It looks mostly good, expect for a few details,
> see below.
> 
> > diff --git a/board/terasic/de10nano_cyclone5/genimage.cfg b/board/terasic/de10nano_cyclone5/genimage.cfg
> > new file mode 100644
> > index 0000000000..3261c62741
> > --- /dev/null
> > +++ b/board/terasic/de10nano_cyclone5/genimage.cfg
> > @@ -0,0 +1,57 @@
> > +image boot.vfat {
> > +	vfat {
> > +		file zImage {
> > +            image = "zImage"
> > +        }  
> 
> Starting from here the indentation is not correct.
Oups... -> fixed in v4
> 
> > +
> > +        file socfpga_cyclone5_de0_nano_soc.dtb {
> > +            image = "socfpga_cyclone5_de0_nano_soc.dtb"
> > +        }
> > +
> > +        file barebox.bin {
> > +            image = "barebox-socfpga-de10_nano.img"
> > +        }
> > +
> > +        file barebox.env {
> > +            image = "barebox-env"
> > +        }
> > +	}
> > +	size = 8M  
> 
> Could you fix the indentation in this block ?
> 
> > +}
> > +
> > +image boot.img {
> > +	hdimage {
> > +		partition-table = "no"
> > +	}
> > +
> > +	partition spl {
> > +		in-partition-table = "no"
> > +		image = "barebox-socfpga-de10_nano-xload.img"
> > +		offset = 0
> > +		size = 64k
> > +	}
> > +
> > +	size = 1M
> > +}  
> 
> I don't understand why you have a boot.img, which apparently only
> contains the raw contacts of this xload.img file. Why not use this
> xload.img file directly...
> 
In fact unlike some others CPU, this is not a raw area but a real partition
with type 0xA2. This genimage is based on socrate board wich use the same way.
> > +
> > +image sdcard.img {
> > +	hdimage {
> > +	}
> > +
> > +	partition spl {
> > +		partition-type = 0xa2
> > +		image = "boot.img"  
> 
> .. here ?
> 
> Example from another genimage.cfg:
> 
>         partition spl {
>                 in-partition-table = "no"
>                 image = "sunxi-spl.bin"
>                 offset = 8192
>         }
> 
>         partition u-boot {
>                 in-partition-table = "no"
>                 image = "u-boot.itb"
>                 offset = 40K
>                 size = 1M # 1MB - 40K
>         }
> 
> > +	partition rootfs {
> > +		partition-type = 0x83
> > +		image = "rootfs.ext2"
> > +		size = 500M  
> 
> I'd suggest to not put a size here, and instead tweak the size of the
> ext2 filesystem in the defconfig. Indeed, having a larger partition but
> not a larger filesystem is kind of useless (or requires a resize of the
> filesystem when booting).
>
Done for v4
> 
> > diff --git a/configs/terasic_de10nano_cyclone5_defconfig b/configs/terasic_de10nano_cyclone5_defconfig
> > new file mode 100644
> > index 0000000000..4a356f31a8
> > --- /dev/null
> > +++ b/configs/terasic_de10nano_cyclone5_defconfig
> > @@ -0,0 +1,28 @@
> > +BR2_arm=y
> > +BR2_cortex_a9=y
> > +BR2_ARM_ENABLE_NEON=y
> > +BR2_ARM_ENABLE_VFP=y
> > +BR2_ARM_FPU_NEON=y
> > +BR2_KERNEL_HEADERS_5_11=y  
> 
> Could you use:
> 
> BR2_PACKAGE_HOST_LINUX_HEADERS_CUSTOM_5_11=y
> 
> instead ?
Done for v4
> 
> Could you adjust those small details and send a v4?
> 
> Thanks a lot!
> 
> Thomas

Thanks
Gwen
_______________________________________________
buildroot mailing list
buildroot@busybox.net
http://lists.busybox.net/mailman/listinfo/buildroot

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [Buildroot] [PATCH v3] board: Add support for terasic DE10 Nano
  2021-07-25 16:05   ` Gwenhael Goavec-Merou
@ 2021-07-25 17:35     ` Thomas Petazzoni
  2021-07-26  7:16       ` Gwenhael Goavec-Merou
  0 siblings, 1 reply; 5+ messages in thread
From: Thomas Petazzoni @ 2021-07-25 17:35 UTC (permalink / raw)
  To: Gwenhael Goavec-Merou; +Cc: Gwenhael Goavec-Merou, buildroot

On Sun, 25 Jul 2021 18:05:33 +0200
Gwenhael Goavec-Merou <gwenj@trabucayre.com> wrote:

> > I don't understand why you have a boot.img, which apparently only
> > contains the raw contacts of this xload.img file. Why not use this
> > xload.img file directly...
> >   
> In fact unlike some others CPU, this is not a raw area but a real partition
> with type 0xA2. This genimage is based on socrate board wich use the same way.

Well, but still, why don't you directly use xload.img as the partition
image ?

Thomas
-- 
Thomas Petazzoni, co-owner and CEO, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com
_______________________________________________
buildroot mailing list
buildroot@busybox.net
http://lists.busybox.net/mailman/listinfo/buildroot

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [Buildroot] [PATCH v3] board: Add support for terasic DE10 Nano
  2021-07-25 17:35     ` Thomas Petazzoni
@ 2021-07-26  7:16       ` Gwenhael Goavec-Merou
  0 siblings, 0 replies; 5+ messages in thread
From: Gwenhael Goavec-Merou @ 2021-07-26  7:16 UTC (permalink / raw)
  To: Thomas Petazzoni; +Cc: Gwenhael Goavec-Merou, buildroot

On Sun, 25 Jul 2021 19:35:49 +0200
Thomas Petazzoni <thomas.petazzoni@bootlin.com> wrote:

> On Sun, 25 Jul 2021 18:05:33 +0200
> Gwenhael Goavec-Merou <gwenj@trabucayre.com> wrote:
> 
> > > I don't understand why you have a boot.img, which apparently only
> > > contains the raw contacts of this xload.img file. Why not use this
> > > xload.img file directly...
> > >     
> > In fact unlike some others CPU, this is not a raw area but a real partition
> > with type 0xA2. This genimage is based on socrate board wich use the same way.  
> 
> Well, but still, why don't you directly use xload.img as the partition
> image ?
Done in v5
> 
> Thomas
> -- 
> Thomas Petazzoni, co-owner and CEO, Bootlin
> Embedded Linux and Kernel engineering
> https://bootlin.com

Thanks
Gwenhael
_______________________________________________
buildroot mailing list
buildroot@busybox.net
http://lists.busybox.net/mailman/listinfo/buildroot

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2021-07-26  7:17 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-07-21 12:59 [Buildroot] [PATCH v3] board: Add support for terasic DE10 Nano Gwenhael Goavec-Merou
2021-07-25 14:08 ` Thomas Petazzoni
2021-07-25 16:05   ` Gwenhael Goavec-Merou
2021-07-25 17:35     ` Thomas Petazzoni
2021-07-26  7:16       ` Gwenhael Goavec-Merou

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.