configs/odroidc2: new defconfig
authorDagg Stompler <daggs@gmx.com>
Fri, 17 Jul 2020 16:46:42 +0000 (19:46 +0300)
committerThomas Petazzoni <thomas.petazzoni@bootlin.com>
Thu, 3 Sep 2020 18:46:07 +0000 (20:46 +0200)
Signed-off-by: Dagg Stompler <daggs@gmx.com>
Signed-off-by: Thomas Petazzoni <thomas.petazzoni@bootlin.com>
DEVELOPERS
board/hardkernel/odroidc2/boot.cmd [new file with mode: 0644]
board/hardkernel/odroidc2/genimage.cfg [new file with mode: 0644]
board/hardkernel/odroidc2/post-image.sh [new file with mode: 0755]
board/hardkernel/odroidc2/readme.txt [new file with mode: 0644]
board/hardkernel/odroidc2/rootfs_overlay/etc/init.d/S09modload [new file with mode: 0755]
configs/odroidc2_defconfig [new file with mode: 0644]

index 8c3f47cdb7ef733b381ab22b3e2eaaa2325f56bc..8faaf890c06a54204c990aaa654767571c794c3f 100644 (file)
@@ -635,6 +635,8 @@ F:  arch/Config.in.powerpc
 F:     package/kvm-unit-tests
 
 N:     Dagg Stompler <daggs@gmx.com>
+F:     board/odroidc2/
+F:     configs/odroidc2_defconfig
 F:     package/meson-tools/
 F:     package/odroidc2-firmware/
 
diff --git a/board/hardkernel/odroidc2/boot.cmd b/board/hardkernel/odroidc2/boot.cmd
new file mode 100644 (file)
index 0000000..d800a6d
--- /dev/null
@@ -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 (file)
index 0000000..c9306b0
--- /dev/null
@@ -0,0 +1,39 @@
+image boot.vfat {
+       vfat {
+               files = {
+                       "Image",
+                       "meson-gxbb-odroidc2.dtb",
+                       "boot.scr"
+               }
+       }
+       size = 64M
+}
+
+image sdcard.img {
+       hdimage {
+       }
+
+       partition bl1 {
+               in-partition-table = "no"
+               image = "bl1.bin.hardkernel"
+               offset = 0
+       }
+
+       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-image.sh b/board/hardkernel/odroidc2/post-image.sh
new file mode 100755 (executable)
index 0000000..eb6fd4f
--- /dev/null
@@ -0,0 +1,21 @@
+#!/bin/sh
+
+BOARD_DIR="$(dirname $0)"
+
+${HOST_DIR}/bin/fip_create \
+       --bl30 ${BINARIES_DIR}/bl30.bin \
+       --bl301 ${BINARIES_DIR}/bl301.bin \
+       --bl31 ${BINARIES_DIR}/bl31.bin \
+       --bl33 ${BINARIES_DIR}/u-boot.bin \
+       ${BINARIES_DIR}/fip.bin
+
+${HOST_DIR}/bin/fip_create --dump ${BINARIES_DIR}/fip.bin
+
+cat ${BINARIES_DIR}/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=${BINARIES_DIR}/uboot-odc2.img bs=512 skip=96
+
+support/scripts/genimage.sh -c ${BOARD_DIR}/genimage.cfg
diff --git a/board/hardkernel/odroidc2/readme.txt b/board/hardkernel/odroidc2/readme.txt
new file mode 100644 (file)
index 0000000..2484782
--- /dev/null
@@ -0,0 +1,64 @@
+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/
+    +-- bl1.bin.hardkernel
+    +-- bl2.package
+    +-- bl301.bin
+    +-- bl30.bin
+    +-- bl31.bin
+    +-- boot_new.bin
+    +-- boot.scr                   [1]
+    +-- boot.vfat
+    +-- fip.bin
+    +-- Image                      [2]
+    +-- meson-gxbb-odroidc2.dtb
+    +-- rootfs.ext2
+    +-- rootfs.ext4
+    +-- rootfs.tar
+    +-- sdcard.img
+    +-- u-boot.bin
+    +-- u-boot.img
+    +-- uboot-odc2.img             [3]
+
+[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 (executable)
index 0000000..8d694a7
--- /dev/null
@@ -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
diff --git a/configs/odroidc2_defconfig b/configs/odroidc2_defconfig
new file mode 100644 (file)
index 0000000..bb85431
--- /dev/null
@@ -0,0 +1,37 @@
+# Architecture
+BR2_aarch64=y
+
+# System
+BR2_TARGET_GENERIC_HOSTNAME="odroidc2"
+BR2_TARGET_GENERIC_GETTY_PORT="ttyAML0"
+BR2_TARGET_GENERIC_GETTY_BAUDRATE_115200=y
+BR2_TARGET_ROOTFS_EXT2=y
+BR2_TARGET_ROOTFS_EXT2_4=y
+BR2_ROOTFS_OVERLAY="board/hardkernel/odroidc2/rootfs_overlay"
+BR2_ROOTFS_POST_IMAGE_SCRIPT="board/hardkernel/odroidc2/post-image.sh"
+
+# Kernel
+BR2_LINUX_KERNEL=y
+BR2_LINUX_KERNEL_CUSTOM_VERSION=y
+BR2_LINUX_KERNEL_CUSTOM_VERSION_VALUE="5.7"
+BR2_LINUX_KERNEL_DTS_SUPPORT=y
+BR2_LINUX_KERNEL_INTREE_DTS_NAME="amlogic/meson-gxbb-odroidc2"
+BR2_LINUX_KERNEL_USE_ARCH_DEFAULT_CONFIG=y
+
+# U-Boot
+BR2_TARGET_UBOOT=y
+BR2_TARGET_UBOOT_BUILD_SYSTEM_LEGACY=y
+BR2_TARGET_UBOOT_BOARDNAME="odroid-c2"
+BR2_TARGET_UBOOT_CUSTOM_VERSION="2020.07"
+BR2_TARGET_UBOOT_NEEDS_DTC=y
+BR2_TARGET_UBOOT_BOOT_SCRIPT=y
+BR2_TARGET_UBOOT_BOOT_SCRIPT_SOURCE="board/hardkernel/odroidc2/boot.cmd"
+
+# Firmware
+BR2_PACKAGE_ODROIDC2_FIRMWARE=y
+
+# Required tools to create the SD image
+BR2_PACKAGE_HOST_DOSFSTOOLS=y
+BR2_PACKAGE_HOST_GENIMAGE=y
+BR2_PACKAGE_HOST_MESON_TOOLS=y
+BR2_PACKAGE_HOST_MTOOLS=y