From patchwork Mon May 31 23:02:32 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Diego Lozano X-Patchwork-Id: 1485818 Return-Path: X-Original-To: incoming-buildroot@patchwork.ozlabs.org Delivered-To: patchwork-incoming-buildroot@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=busybox.net (client-ip=2605:bc80:3010::138; helo=smtp1.osuosl.org; envelope-from=buildroot-bounces@busybox.net; receiver=) Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20161025 header.b=jIZzMXHD; dkim-atps=neutral Received: from smtp1.osuosl.org (smtp1.osuosl.org [IPv6:2605:bc80:3010::138]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4Fv9nL3g02z9sRf for ; Tue, 1 Jun 2021 09:03:16 +1000 (AEST) Received: from localhost (localhost [127.0.0.1]) by smtp1.osuosl.org (Postfix) with ESMTP id F02F283C0F; Mon, 31 May 2021 23:03:12 +0000 (UTC) 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 P3Xmd2fhaRFu; Mon, 31 May 2021 23:03:12 +0000 (UTC) Received: from ash.osuosl.org (ash.osuosl.org [140.211.166.34]) by smtp1.osuosl.org (Postfix) with ESMTP id 0C54D83C03; Mon, 31 May 2021 23:03:10 +0000 (UTC) X-Original-To: buildroot@lists.busybox.net Delivered-To: buildroot@osuosl.org Received: from smtp3.osuosl.org (smtp3.osuosl.org [140.211.166.136]) by ash.osuosl.org (Postfix) with ESMTP id AAD321BF27C for ; Mon, 31 May 2021 23:03:09 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by smtp3.osuosl.org (Postfix) with ESMTP id 935E56066A for ; Mon, 31 May 2021 23:03:09 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Authentication-Results: smtp3.osuosl.org (amavisd-new); dkim=pass (2048-bit key) header.d=gmail.com Received: from smtp3.osuosl.org ([127.0.0.1]) by localhost (smtp3.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id OzMl9uFhU1o2 for ; Mon, 31 May 2021 23:03:08 +0000 (UTC) X-Greylist: whitelisted by SQLgrey-1.8.0 Received: from mail-wm1-x335.google.com (mail-wm1-x335.google.com [IPv6:2a00:1450:4864:20::335]) by smtp3.osuosl.org (Postfix) with ESMTPS id 033626064B for ; Mon, 31 May 2021 23:03:07 +0000 (UTC) Received: by mail-wm1-x335.google.com with SMTP id n5-20020a1c72050000b0290192e1f9a7e1so753993wmc.2 for ; Mon, 31 May 2021 16:03:07 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=QUicwBhpePNIsoonhGV/dMRv09jw87t7rq4kPfcpaUA=; b=jIZzMXHDSwkslNB5B06ZseOzLDxvfFhc8zMvpA6/9qrcmjmhwWxur0Sd2o4sHRZya1 +SCsz3gWVRXIuubWL1i8DcFiMbBe9tTuIiu/gk6hmKN0Gw+ZnbMB3iP60bCwa7u8i3wv Gx3semxx6MT69VUQBmnC9ev6Ldz9aGK5mJf6pl8OYn3MI0vqMOBdvdb56yM18VRc1iHK CTVyMYlFyPz6SPS0pG66993RWDtu7m468AAuyVdjMzruUnuhrny8MdhznC8WZJNmrGo1 mnenMo+XKk9qwHU2iYdnSjDaBZODuD+LpzsJqWAtR9G8Eo6YPzyVSjzSlsXH+HpC0+qo bnig== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=QUicwBhpePNIsoonhGV/dMRv09jw87t7rq4kPfcpaUA=; b=Mj1R40Y2F8RFDyC5Yj9x7CN6w/N5ecr1fgcIq52u5iwF3UstJd5WGXoJ9ZpBOVpX9x d7IEre+K1Q0BPR1SA7xA7T/GMKqnfD9XA0K89+3lb8XnYL9TdV1c2S//W8OJtb8eAcOy 0l3L3EJrHuTbxNt3FJGC77UISLBrLfNnMucfRD1OMkyriyE5AsooUs2b7rw5Q7wv7zpk +0R4GW75WMiAqinJVvMzhrydkYYbmiWxA7hEC3j+vuF1HJmWVwFHzT6eVMYzukaKghOK 1vk3762yASVPqhNDqcDfK3oWnaJP5EyoxAs/h5XdGLluT7Ntllc0uxCqWNcgGPUjny8p 46nQ== X-Gm-Message-State: AOAM532106VH8++J2sC8xJOccLHYMioc81KPX+koOPE5O7UnbB9FFwZF SrUH81I2z7D8B4ya0dAUowYECQL4tLgJQWDp X-Google-Smtp-Source: ABdhPJx1c3lAXI4Tt2vA2iKqxjiKAJGLneApKrT242Je1Q1uMk1us3ooW9DU6jWRCaYi+lCB4bXrzw== X-Received: by 2002:a05:600c:2248:: with SMTP id a8mr2645772wmm.5.1622502186084; Mon, 31 May 2021 16:03:06 -0700 (PDT) Received: from localhost.localdomain ([139.47.96.34]) by smtp.googlemail.com with ESMTPSA id r14sm948240wrx.74.2021.05.31.16.03.05 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 31 May 2021 16:03:05 -0700 (PDT) From: Diego Lozano To: buildroot@buildroot.org Date: Tue, 1 Jun 2021 01:02:32 +0200 Message-Id: <20210531230232.866757-1-diego.lofer@gmail.com> X-Mailer: git-send-email 2.30.2 MIME-Version: 1.0 Subject: [Buildroot] [PATCH 1/1] board/altera: added Terasic de0nano board support X-BeenThere: buildroot@busybox.net 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: Diego Lozano Errors-To: buildroot-bounces@busybox.net Sender: "buildroot" de0nano board (also known as atlas soc) is currently not supported by buildroot. With this patch a new defconfig is added for this target. It can generate a .img to be flashed directly in a SD card and boot it. Note that configs/ folder is also modified in this patch, as the new board defconfig is created. Signed-off-by: Diego Lozano --- board/altera/de0nano_cyclone5/boot.scr | 9 +++ board/altera/de0nano_cyclone5/genimage.cfg | 66 +++++++++++++++++++++ board/altera/de0nano_cyclone5/post-image.sh | 20 +++++++ board/altera/de0nano_cyclone5/uboot-env.txt | 1 + configs/de0nano_cyclone5_defconfig | 42 +++++++++++++ 5 files changed, 138 insertions(+) create mode 100644 board/altera/de0nano_cyclone5/boot.scr create mode 100644 board/altera/de0nano_cyclone5/genimage.cfg create mode 100755 board/altera/de0nano_cyclone5/post-image.sh create mode 100644 board/altera/de0nano_cyclone5/uboot-env.txt create mode 100644 configs/de0nano_cyclone5_defconfig diff --git a/board/altera/de0nano_cyclone5/boot.scr b/board/altera/de0nano_cyclone5/boot.scr new file mode 100644 index 0000000000..38965fce90 --- /dev/null +++ b/board/altera/de0nano_cyclone5/boot.scr @@ -0,0 +1,9 @@ +echo === Setting bootargs === +setenv bootargs console=ttyS0,115200n8 root=PARTUUID=00000000-03 rw rootfstype=ext4 rootwait + +echo === Loadding elements === +fatload mmc 0:2 ${loadaddr} zImage +fatload mmc 0:2 ${fdt_addr_r} socfpga_cyclone5_de0_nano_soc.dtb + +echo === Starting out === +bootz ${loadaddr} - ${fdt_addr_r} diff --git a/board/altera/de0nano_cyclone5/genimage.cfg b/board/altera/de0nano_cyclone5/genimage.cfg new file mode 100644 index 0000000000..20e3f89b80 --- /dev/null +++ b/board/altera/de0nano_cyclone5/genimage.cfg @@ -0,0 +1,66 @@ +# Image of the partition with: +# - Kernel zImage +# - Flattened device tree +# - Startup u-boot script +image boot.vfat { + vfat { + files = { + "zImage", + "socfpga_cyclone5_de0_nano_soc.dtb", + "boot.scr.uimg", + } + } + size = 16M +} + +# Bootloader image +image uboot.img { + hdimage { + partition-table = "no" + } + + partition spl { + in-partition-table = "no" + image = "u-boot-with-spl.sfp" + offset = 0 + size = 900k + } + + size = 1M +} + +# Main image +image sdcard.img { + hdimage { + } + + # Optional: set env variables through env image + # using mkvenv. + # U-Boot CONFIG_ENV_OFFSET variable is 0x4400 + # Sector size is 512 bytes + # 0x4400 is 17408 bytes + # 17408 / 512 = 34 sectors offset + #partition uboot-env { + # in-partition-table = "no" + # image = "uboot-env.bin" + # offset = 17408 + #} + partition uboot { + partition-type = 0xa2 + image = "uboot.img" + offset = 1M + } + + partition boot { + partition-type = 0xC + bootable = "true" + image = "boot.vfat" + } + + partition rootfs { + partition-type = 0x83 + image = "rootfs.ext4" + size = 30M + } + +} diff --git a/board/altera/de0nano_cyclone5/post-image.sh b/board/altera/de0nano_cyclone5/post-image.sh new file mode 100755 index 0000000000..c3642789e9 --- /dev/null +++ b/board/altera/de0nano_cyclone5/post-image.sh @@ -0,0 +1,20 @@ +#!/bin/sh + +# Store current directory +BOARD_DIR="$(dirname $0)" + +# Generate the boot script boot.scr.img +${HOST_DIR}/bin/mkimage -T script -C none -n 'BootLinux' -d ${BOARD_DIR}/boot.scr ${BINARIES_DIR}/boot.scr.uimg + +# Generate the SD Card image +GENIMAGE_CFG="${BOARD_DIR}/genimage.cfg" +GENIMAGE_TMP="${BUILD_DIR}/genimage.tmp" + +rm -rf "${GENIMAGE_TMP}" + +${HOST_DIR}/bin/genimage \ + --config "${GENIMAGE_CFG}" \ + --rootpath "${TARGET_DIR}" \ + --inputpath "${BINARIES_DIR}" \ + --outputpath "${BINARIES_DIR}" \ + --tmppath "${GENIMAGE_TMP}" diff --git a/board/altera/de0nano_cyclone5/uboot-env.txt b/board/altera/de0nano_cyclone5/uboot-env.txt new file mode 100644 index 0000000000..4091b3dbe0 --- /dev/null +++ b/board/altera/de0nano_cyclone5/uboot-env.txt @@ -0,0 +1 @@ +test=1 diff --git a/configs/de0nano_cyclone5_defconfig b/configs/de0nano_cyclone5_defconfig new file mode 100644 index 0000000000..321f24b67b --- /dev/null +++ b/configs/de0nano_cyclone5_defconfig @@ -0,0 +1,42 @@ +BR2_arm=y +BR2_cortex_a9=y +BR2_ARM_ENABLE_NEON=y +BR2_ARM_ENABLE_VFP=y +BR2_ARM_FPU_NEON=y +BR2_CCACHE=y +BR2_TOOLCHAIN_BUILDROOT_GLIBC=y +BR2_KERNEL_HEADERS_5_4=y +BR2_GCC_VERSION_10_X=y +BR2_TOOLCHAIN_BUILDROOT_CXX=y +BR2_TARGET_GENERIC_HOSTNAME="de0nano" +BR2_TARGET_GENERIC_GETTY_BAUDRATE_115200=y +BR2_ROOTFS_POST_IMAGE_SCRIPT="board/altera/de0nano_cyclone5/post-image.sh" +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="socfpga-5.4.104-lts" +BR2_LINUX_KERNEL_DEFCONFIG="socfpga" +BR2_LINUX_KERNEL_DTS_SUPPORT=y +BR2_LINUX_KERNEL_INTREE_DTS_NAME="socfpga_cyclone5_de0_nano_soc" +BR2_PACKAGE_UBOOT_TOOLS=y +BR2_PACKAGE_UBOOT_TOOLS_MKIMAGE=y +# BR2_PACKAGE_UBOOT_TOOLS_FWPRINTENV is not set +BR2_TARGET_ROOTFS_EXT2=y +BR2_TARGET_ROOTFS_EXT2_4=y +BR2_TARGET_ROOTFS_EXT2_SIZE="30M" +# BR2_TARGET_ROOTFS_TAR is not set +BR2_TARGET_UBOOT=y +BR2_TARGET_UBOOT_BUILD_SYSTEM_KCONFIG=y +BR2_TARGET_UBOOT_CUSTOM_VERSION=y +BR2_TARGET_UBOOT_CUSTOM_VERSION_VALUE="2021.01" +BR2_TARGET_UBOOT_BOARD_DEFCONFIG="socfpga_de0_nano_soc" +# BR2_TARGET_UBOOT_FORMAT_BIN is not set +BR2_TARGET_UBOOT_FORMAT_CUSTOM=y +BR2_TARGET_UBOOT_FORMAT_CUSTOM_NAME="u-boot-with-spl.sfp" +BR2_PACKAGE_HOST_GENIMAGE=y +BR2_PACKAGE_HOST_UBOOT_TOOLS=y +BR2_PACKAGE_HOST_UBOOT_TOOLS_ENVIMAGE=y +BR2_PACKAGE_HOST_UBOOT_TOOLS_ENVIMAGE_SOURCE="board/altera/de0nano_cyclone5/uboot-env.txt" +BR2_PACKAGE_HOST_UBOOT_TOOLS_ENVIMAGE_SIZE="0x2000" +BR2_PACKAGE_HOST_UBOOT_TOOLS_BOOT_SCRIPT=y +BR2_PACKAGE_HOST_UBOOT_TOOLS_BOOT_SCRIPT_SOURCE="board/altera/de0nano_cyclone5/boot.scr"