Skip to contentSkip to conversation

odroidc2: add support for mainline kernel and u-boot

PATCH Superseded Dagg Stompler 2 participants 3 messages Dec 16, 2017 – Dec 20, 2017 Arm/Amlogic Meson SoC support

v3 of 4 Superseded Latest is v4 →

lore
Share & tools
lore
#0 lore raw

PATCH v3 1/1 odroidc2: add support for mainline kernel and u-boot

---
Changes v2 -> v3:
- board/hardkernel/odroidc2/odroidc2_mainline_defconfig is not needed because update_arm64_defconfig_with_meson_configs.patch is used.

Changes v1 -> v2:
- handle general mail patch rejects (Thomas)
- use BR2_TARGET_UBOOT_BOOT_SCRIPT and BR2_TARGET_UBOOT_BOOT_SCRIPT_SOURCE instead of script's boot.scr generation (Thomas)
- use defconfig in mainline kernel config (Thomas)
- add patch of mainline kernel diff instead of complete config and use arch default config (Arnout)
- move vendor's ATF handling to a separated patch (Thomas)
- add mainline config support for post image script (Thomas)
- fixed mainline defconfig rejects (Thomas)
- squashed all previous 2-8 patches into one patch (Thomas)

 board/hardkernel/odroidc2/boot.cmd                 |  10 +
 board/hardkernel/odroidc2/genimage-mainline.cfg    |  33 ++
 ...update_arm64_defconfig_with_meson_configs.patch | 642 +++++++++++++++++++++
 board/hardkernel/odroidc2/post-build.sh            |  12 +
 board/hardkernel/odroidc2/post-image.sh            |  25 +-
 board/hardkernel/odroidc2/readme.txt               |  27 +-
 configs/odroidc2_mainline_defconfig                |  38 ++
 7 files changed, 782 insertions(+), 5 deletions(-)
 create mode 100644 board/hardkernel/odroidc2/boot.cmd
 create mode 100644 board/hardkernel/odroidc2/genimage-mainline.cfg
 create mode 100644 board/hardkernel/odroidc2/patches/linux/0001-update_arm64_defconfig_with_meson_configs.patch
 create mode 100755 board/hardkernel/odroidc2/post-build.sh
 create mode 100644 configs/odroidc2_mainline_defconfig
board/hardkernel/odroidc2/boot.cmd new file +10 -0
new file mode 100644
index 0000000000..85a1a0a020
@@ -0,0 +1,10 @@
+setenv loadaddr "0x1080000"
+setenv dtb_loadaddr "0x01000000"
+setenv kernel_filename "uImage"
+setenv fdt_filename "meson-gxbb-odroidc2.dtb"
+setenv bootargs "console=ttyAML0,115200n8 earlyprintk root=/dev/mmcblk1p2 rootwait panic=10 ${extra} rw"
+
+fatload mmc 0:1 ${loadaddr} ${kernel_filename}
+fatload mmc 0:1 ${dtb_loadaddr} ${fdt_filename}
+
+bootm ${loadaddr} - ${dtb_loadaddr}
board/hardkernel/odroidc2/genimage-mainline.cfg new file +33 -0
new file mode 100644
index 0000000000..77e4d6dd2f
@@ -0,0 +1,33 @@
+image boot.vfat {
+	vfat {
+		files = {
+			"uImage",
+			"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
+	}
+}
board/hardkernel/odroidc2/patches/linux/0001-update_arm64_defconfig_with_meson_configs.patch new file +642 -0

642 lines not on this page · raw message

board/hardkernel/odroidc2/post-build.sh new file +12 -0
new file mode 100755
index 0000000000..30e1dd2f0e
@@ -0,0 +1,12 @@
+#!/bin/sh
+# post-build.sh for Odroid C2 taken from CubieBoard's post-build.sh
+# 2013, Carlo Caione <[email protected]>
+
+BOARD_DIR="$(dirname $0)"
+MKIMAGE=$HOST_DIR/bin/mkimage
+
+# vendor u-boot uses uImage
+if [ -f "${BINARIES_DIR}/Image" ]; then
+    ${MKIMAGE} -A arm64 -O linux -T kernel -C none -a 0x1080000 -e 0x1080000 \
+	     -n linux -d ${BINARIES_DIR}/Image ${BINARIES_DIR}/uImage
+fi
board/hardkernel/odroidc2/post-image.sh +22 -3
index a53f87ec11..bc885d4c51 100755
@@ -2,12 +2,29 @@
 
 BOARD_DIR="$(dirname $0)"
 GENIMAGE_TMP="${BUILD_DIR}/genimage.tmp"
+TARGET_MAINLINE="$2"
 IM_FILE=""
+CLEANUPS_CMD=""
 
-GENIMAGE_CFG="${BOARD_DIR}/genimage.cfg"
-IM_FILE="${BINARIES_DIR}/u-boot.bin"
+if [ "${TARGET_MAINLINE}" = "yes" ]; then
+	GENIMAGE_CFG="${BOARD_DIR}/genimage-mainline.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"
+	CLEANUPS_CMD="rm -rf ${BINARIES_DIR}/fip.bin ${BINARIES_DIR}/boot_new.bin ${BINARIES_DIR}/u-boot.img"
 
-cp ${BOARD_DIR}/boot.ini ${BINARIES_DIR}/
+	${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
+else
+	GENIMAGE_CFG="${BOARD_DIR}/genimage.cfg"
+	IM_FILE="${BINARIES_DIR}/u-boot.bin"
+
+	cp ${BOARD_DIR}/boot.ini ${BINARIES_DIR}/
+fi
 
 rm -rf "${GENIMAGE_TMP}"
 
@@ -20,3 +37,5 @@ genimage                           \
 
 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
+
+${CLEANUPS_CMD}
board/hardkernel/odroidc2/readme.txt +25 -2
index b44aa67f5a..1ca90546b5 100644
@@ -10,7 +10,11 @@ How to build it
 
   $ make odroidc2_defconfig
 
-Then you can edit the build options using
+For vendor based configuration or
+
+  $ make odroidc2_mainline_defconfig
+
+For community based configuration, then you can edit the build options using
 
   $ make menuconfig
 
@@ -24,7 +28,9 @@ download the packages' sources.
 Result of the build
 -------------------
 
-After building, you should obtain this tree:
+After building, you should obtain one of the following trees:
+
+For vendor based configuration:
 
     output/images/
     +-- Image
@@ -37,7 +43,24 @@ After building, you should obtain this tree:
     +-- sdcard.img
     `-- u-boot.bin
 
+For community based configuration:
+
+    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
 ================================
configs/odroidc2_mainline_defconfig new file +38 -0
new file mode 100644
index 0000000000..6a4015425e
@@ -0,0 +1,38 @@
+# Architecture
+BR2_aarch64=y
+
+# System
+BR2_TARGET_GENERIC_HOSTNAME="odroidc2"
+BR2_TARGET_ROOTFS_EXT2=y
+BR2_TARGET_ROOTFS_EXT2_4=y
+BR2_GLOBAL_PATCH_DIR="board/hardkernel/odroidc2/patches"
+BR2_ROOTFS_POST_BUILD_SCRIPT="board/hardkernel/odroidc2/post-build.sh"
+BR2_ROOTFS_POST_IMAGE_SCRIPT="board/hardkernel/odroidc2/post-image.sh"
+BR2_ROOTFS_POST_SCRIPT_ARGS="yes"
+BR2_KERNEL_HEADERS_4_14=y
+
+# Kernel
+BR2_LINUX_KERNEL=y
+BR2_LINUX_KERNEL_USE_ARCH_DEFAULT_CONFIG=y
+BR2_LINUX_KERNEL_CUSTOM_VERSION=y
+BR2_LINUX_KERNEL_CUSTOM_VERSION_VALUE="4.14.4"
+BR2_LINUX_KERNEL_DTS_SUPPORT=y
+BR2_LINUX_KERNEL_INTREE_DTS_NAME="amlogic/meson-gxbb-odroidc2"
+BR2_LINUX_KERNEL_IMAGE=y
+
+# U-Boot
+BR2_TARGET_UBOOT=y
+BR2_TARGET_UBOOT_BOARDNAME="odroid-c2"
+BR2_TARGET_UBOOT_NEEDS_DTC=y
+BR2_TARGET_UBOOT_BOOT_SCRIPT=y
+BR2_TARGET_UBOOT_BOOT_SCRIPT_SOURCE="board/hardkernel/odroidc2/boot.cmd"
+BR2_TARGET_UBOOT_CUSTOM_VERSION=y
+BR2_TARGET_UBOOT_CUSTOM_VERSION_VALUE="2017.11"
+
+# 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
+BR2_PACKAGE_HOST_UBOOT_TOOLS=y
+BR2_PACKAGE_HOST_ODROIDC2_ATF=y
Signature · 1 line
2.15.1
#1 lore raw

PATCH v3 1/1 odroidc2: add support for mainline kernel and u-boot

Quoted 13 lines

Changes v2 -> v3:
- board/hardkernel/odroidc2/odroidc2_mainline_defconfig is not needed because update_arm64_defconfig_with_meson_configs.patch is used.

Changes v1 -> v2:
- handle general mail patch rejects (Thomas)
- use BR2_TARGET_UBOOT_BOOT_SCRIPT and BR2_TARGET_UBOOT_BOOT_SCRIPT_SOURCE instead of script's boot.scr generation (Thomas)
- use defconfig in mainline kernel config (Thomas)
- add patch of mainline kernel diff instead of complete config and use arch default config (Arnout)
- move vendor's ATF handling to a separated patch (Thomas)
- add mainline config support for post image script (Thomas)
- fixed mainline defconfig rejects (Thomas)
- squashed all previous 2-8 patches into one patch (Thomas)

[...]

configs/odroidc2_mainline_defconfig line 38

Quoted 7 lines
configs/odroidc2_mainline_defconfig new file +7 -0
+# 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
+BR2_PACKAGE_HOST_UBOOT_TOOLS=y
+BR2_PACKAGE_HOST_ODROIDC2_ATF=y

I don't see neither meson-tools nor odroid2-atf packages in v3. Am I missing something ?

Regards,
Sergey

author
#2 lore raw

PATCH v3 1/1 odroidc2: add support for mainline kernel and u-boot

Greetings Sergey,

Quoted 17 lines
Quoted 14 lines

Changes v2 -> v3:
- board/hardkernel/odroidc2/odroidc2_mainline_defconfig is not needed because update_arm64_defconfig_with_meson_configs.patch is used.

Changes v1 -> v2:
- handle general mail patch rejects (Thomas)
- use BR2_TARGET_UBOOT_BOOT_SCRIPT and BR2_TARGET_UBOOT_BOOT_SCRIPT_SOURCE instead of script's boot.scr generation (Thomas)
- use defconfig in mainline kernel config (Thomas)
- add patch of mainline kernel diff instead of complete config and use arch default config (Arnout)
- move vendor's ATF handling to a separated patch (Thomas)
- add mainline config support for post image script (Thomas)
- fixed mainline defconfig rejects (Thomas)
- squashed all previous 2-8 patches into one patch (Thomas)

[...]

Quoted 10 lines

configs/odroidc2_mainline_defconfig line 38

Quoted 7 lines
configs/odroidc2_mainline_defconfig new file +7 -0
+# 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
+BR2_PACKAGE_HOST_UBOOT_TOOLS=y
+BR2_PACKAGE_HOST_ODROIDC2_ATF=y

I don't see neither meson-tools nor odroid2-atf packages in v3. Am I missing something ?

the first 3 patches were not changed, so I saw no value to resend them.

Dagg.