All of lore.kernel.org
 help / color / mirror / Atom feed
From: Dagg Stompler <daggs@gmx.com>
To: buildroot@busybox.net
Subject: [Buildroot] [PATCH 4/5] board/odroidc2: add board
Date: Sat, 18 Apr 2020 18:10:19 +0300	[thread overview]
Message-ID: <20200418151020.17197-4-daggs@gmx.com> (raw)
In-Reply-To: <20200418151020.17197-1-daggs@gmx.com>

re add the odroidc2 board to buildroot.
 - uses latest uboot.
 - uses kernel 5.6

Signed-off-by: Dagg Stompler <daggs@gmx.com>
---
 board/hardkernel/odroidc2/boot.cmd            | 11 ++++
 board/hardkernel/odroidc2/genimage.cfg        | 33 +++++++++++
 board/hardkernel/odroidc2/post-build.sh       |  8 +++
 board/hardkernel/odroidc2/post-image.sh       | 29 ++++++++++
 board/hardkernel/odroidc2/readme.txt          | 57 +++++++++++++++++++
 .../rootfs_overlay/etc/init.d/S09modload      | 23 ++++++++
 6 files changed, 161 insertions(+)
 create mode 100644 board/hardkernel/odroidc2/boot.cmd
 create mode 100644 board/hardkernel/odroidc2/genimage.cfg
 create mode 100755 board/hardkernel/odroidc2/post-build.sh
 create mode 100755 board/hardkernel/odroidc2/post-image.sh
 create mode 100644 board/hardkernel/odroidc2/readme.txt
 create mode 100755 board/hardkernel/odroidc2/rootfs_overlay/etc/init.d/S09modload

diff --git a/board/hardkernel/odroidc2/boot.cmd b/board/hardkernel/odroidc2/boot.cmd
new file mode 100644
index 0000000000..d800a6d44b
--- /dev/null
+++ b/board/hardkernel/odroidc2/boot.cmd
@@ -0,0 +1,11 @@
+setenv kernel_filename "Image"
+setenv fdt_filename "meson-gxbb-odroidc2.dtb"
+setenv bootargs "console=ttyAML0,115200n8 earlyprintk root=/dev/mmcblk1p2 rootwait rw"
+
+echo > Loading Kernel...
+fatload mmc 0:1 ${kernel_addr_r} ${kernel_filename}
+echo > Loading FDT...
+fatload mmc 0:1 ${fdt_addr_r} ${fdt_filename}
+
+echo > Booting System...
+booti ${kernel_addr_r} - ${fdt_addr_r}
diff --git a/board/hardkernel/odroidc2/genimage.cfg b/board/hardkernel/odroidc2/genimage.cfg
new file mode 100644
index 0000000000..a36b924b08
--- /dev/null
+++ b/board/hardkernel/odroidc2/genimage.cfg
@@ -0,0 +1,33 @@
+image boot.vfat {
+	vfat {
+		files = {
+			"Image",
+			"meson-gxbb-odroidc2.dtb",
+			"boot.scr"
+		}
+	}
+	size = 64M
+}
+
+image sdcard.img {
+	hdimage {
+	}
+
+	partition u-boot {
+		in-partition-table = "no"
+		image = "uboot-odc2.img"
+		offset = 49664
+	}
+
+	partition boot {
+		partition-type = 0xC
+		bootable = "true"
+		image = "boot.vfat"
+	}
+
+	partition rootfs {
+		partition-type = 0x83
+		image = "rootfs.ext4"
+		size = 512M
+	}
+}
diff --git a/board/hardkernel/odroidc2/post-build.sh b/board/hardkernel/odroidc2/post-build.sh
new file mode 100755
index 0000000000..745fb2a724
--- /dev/null
+++ b/board/hardkernel/odroidc2/post-build.sh
@@ -0,0 +1,8 @@
+#!/bin/sh
+# post-build.sh for Odroid C2 taken from CubieBoard's post-build.sh
+# 2013, Carlo Caione <carlo.caione@gmail.com>
+
+BOARD_DIR="$(dirname $0)"
+MKIMAGE=$HOST_DIR/bin/mkimage
+
+${MKIMAGE} -A arm64 -O linux -T script -C none -n "Boot script" -d "${BOARD_DIR}/boot.cmd" ${BINARIES_DIR}/boot.scr
diff --git a/board/hardkernel/odroidc2/post-image.sh b/board/hardkernel/odroidc2/post-image.sh
new file mode 100755
index 0000000000..3783a65a1c
--- /dev/null
+++ b/board/hardkernel/odroidc2/post-image.sh
@@ -0,0 +1,29 @@
+#!/bin/sh
+
+BOARD_DIR="$(dirname $0)"
+GENIMAGE_TMP="${BUILD_DIR}/genimage.tmp"
+GENIMAGE_CFG="${BOARD_DIR}/genimage.cfg"
+SIGNED_UBOOT_IMG="${BINARIES_DIR}/uboot-odc2.img"
+ODRODIDC2_ATF_FOLDER="${HOST_DIR}/usr/share/odroidc2_atf"
+IM_FILE="${ODRODIDC2_ATF_FOLDER}/bl1.bin.hardkernel"
+
+${HOST_DIR}/bin/fip_create --bl30 ${ODRODIDC2_ATF_FOLDER}/bl30.bin --bl301 ${ODRODIDC2_ATF_FOLDER}/bl301.bin --bl31 ${ODRODIDC2_ATF_FOLDER}/bl31.bin --bl33 ${BINARIES_DIR}/u-boot.bin ${BINARIES_DIR}/fip.bin
+${HOST_DIR}/bin/fip_create --dump ${BINARIES_DIR}/fip.bin
+cat ${ODRODIDC2_ATF_FOLDER}/bl2.package ${BINARIES_DIR}/fip.bin > ${BINARIES_DIR}/boot_new.bin
+${HOST_DIR}/bin/amlbootsig ${BINARIES_DIR}/boot_new.bin ${BINARIES_DIR}/u-boot.img
+
+dd if=${BINARIES_DIR}/u-boot.img of=${SIGNED_UBOOT_IMG} bs=512 skip=96
+
+rm -rf "${GENIMAGE_TMP}"
+
+genimage                           \
+	--rootpath "${TARGET_DIR}"     \
+	--tmppath "${GENIMAGE_TMP}"    \
+	--inputpath "${BINARIES_DIR}"  \
+	--outputpath "${BINARIES_DIR}" \
+	--config "${GENIMAGE_CFG}"
+
+dd if=${IM_FILE} of=${BINARIES_DIR}/sdcard.img bs=1 count=442 conv=sync,notrunc
+dd if=${IM_FILE} of=${BINARIES_DIR}/sdcard.img bs=512 skip=1 seek=1 conv=fsync,notrunc
+
+rm -rf ${BINARIES_DIR}/fip.bin ${BINARIES_DIR}/boot_new.bin ${BINARIES_DIR}/u-boot.img
diff --git a/board/hardkernel/odroidc2/readme.txt b/board/hardkernel/odroidc2/readme.txt
new file mode 100644
index 0000000000..ef5a91d453
--- /dev/null
+++ b/board/hardkernel/odroidc2/readme.txt
@@ -0,0 +1,57 @@
+ODROID-C2
+
+Intro
+=====
+To be able to use ODROID-C2 board with the images generated by
+Buildroot, you have to prepare the SDCard or eMMC.
+
+How to build it
+===============
+
+  $ make odroidc2_defconfig
+
+Then you can edit the build options using
+
+  $ make menuconfig
+
+Compile all and build rootfs image:
+
+  $ make
+
+Note: you will need to have access to the network, since Buildroot will
+download the packages' sources.
+
+Result of the build
+-------------------
+
+After building, you should obtain this tree:
+
+    output/images/
+    +-- Image
+    +-- uImage			   [2]
+    +-- boot.scr                   [1]
+    +-- boot.vfat
+    +-- meson-gxbb-odroidc2.dtb
+    +-- rootfs.ext2
+    +-- rootfs.ext4
+    +-- rootfs.tar
+    +-- sdcard.img
+    +-- uboot-odc2.img		   [3]
+    `-- u-boot.bin
+
+[1] This is the ODROID-C2 configuration file used in u-boot.
+[2] This is the ODROID-C2 kernel image file which will be booted.
+[3] This is the ODROID-C2 signed u-boot image which will be used.
+
+How to write the SD card or eMMC
+================================
+
+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 or eMMC with "dd":
+
+  $ sudo dd if=output/images/sdcard.img of=/dev/sdX
+
+Insert the SDcard into your ODROID-C2, and power it up. Your new system
+should come up now.
diff --git a/board/hardkernel/odroidc2/rootfs_overlay/etc/init.d/S09modload b/board/hardkernel/odroidc2/rootfs_overlay/etc/init.d/S09modload
new file mode 100755
index 0000000000..9345a411b3
--- /dev/null
+++ b/board/hardkernel/odroidc2/rootfs_overlay/etc/init.d/S09modload
@@ -0,0 +1,23 @@
+#!/bin/sh
+#
+
+load_drivers()
+{
+	echo "Loading needed modules..."
+	for file in $(echo "dwmac_generic dwmac-meson8b meson_dw_hdmi meson_gxbb_wdt"); do
+		modprobe ${file}
+	done
+}
+
+case "$1" in
+	start)
+		load_drivers
+		;;
+	stop)
+		;;
+	restart|reload)
+		;;
+	*)
+		echo "Usage: $0 {start|stop|restart}"
+		exit 1
+esac
--
2.26.1

  parent reply	other threads:[~2020-04-18 15:10 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-04-18 15:10 [Buildroot] [PATCH 1/5] board/odroidc2: remove unused files Dagg Stompler
2020-04-18 15:10 ` [Buildroot] [PATCH 2/5] meson-tools: new Package Dagg Stompler
2020-04-18 15:10 ` [Buildroot] [PATCH 3/5] OdroidC2ATF: " Dagg Stompler
2020-04-18 15:10 ` Dagg Stompler [this message]
2020-04-18 15:10 ` [Buildroot] [PATCH 5/5] configs/odroidc2: add build config Dagg Stompler
2020-04-29 21:23 ` [Buildroot] [PATCH 1/5] board/odroidc2: remove unused files Thomas Petazzoni
2020-05-10 18:26 ` Peter Korsgaard

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20200418151020.17197-4-daggs@gmx.com \
    --to=daggs@gmx.com \
    --cc=buildroot@busybox.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.