Skip to contentSkip to conversation

Odroid XU4: Hardkernel new board support

PATCH Superseded Pierre CROKAERT 2 participants 7 messages Feb 3, 2018 – Oct 21, 2018

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Odroid XU4: Hardkernel new board support

This patch provides support for the board Odroid XU4
This version is using the latest 4.9 kernel released by Hardkernel,
and the current u-boot 2017.05 also from Hardkernel.
The support was implemented based on comments about Andi's patch (https://patchwork.ozlabs.org/patch/640695/).

---
 board/hardkernel/odroidxu4/boot.cmd                | 10 +++
 board/hardkernel/odroidxu4/boot.ini                |  5 ++
 board/hardkernel/odroidxu4/genimage.cfg            | 28 ++++++++
 .../odroidxu4/genimage_bootloader_fragment.cfg     | 29 +++++++++
 board/hardkernel/odroidxu4/post-image.sh           | 50 ++++++++++++++
 board/hardkernel/odroidxu4/readme.txt              | 76 ++++++++++++++++++++++
 configs/odroidxu4_defconfig                        | 28 ++++++++
 7 files changed, 226 insertions(+)
 create mode 100644 board/hardkernel/odroidxu4/boot.cmd
 create mode 100644 board/hardkernel/odroidxu4/boot.ini
 create mode 100644 board/hardkernel/odroidxu4/genimage.cfg
 create mode 100644 board/hardkernel/odroidxu4/genimage_bootloader_fragment.cfg
 create mode 100755 board/hardkernel/odroidxu4/post-image.sh
 create mode 100644 board/hardkernel/odroidxu4/readme.txt
 create mode 100644 configs/odroidxu4_defconfig
board/hardkernel/odroidxu4/boot.cmd new file +10 -0
new file mode 100644
index 0000000..2fb4c16
@@ -0,0 +1,10 @@
+setenv kernelname zImage;
+setenv boot_kernel "setenv bootargs \"${console} root=/dev/mmcblk${mmcrootdev}p${mmcrootpart} rootfstype=${rootfstype} rootwait ${opts}\";
+load mmc ${mmcbootdev}:${mmcbootpart} 0x40007FC0 '${kernelname}';
+if load mmc ${mmcbootdev}:${mmcbootpart} 40800000 ${fdtfile}; then
+	bootz 0x40007FC0 - 40800000;
+else
+	echo Warning! Booting without DTB: '${fdtfile}'!;
+	bootz 0x40007FC0 -;
+fi;"
+run boot_kernel;
\ No newline at end of file
board/hardkernel/odroidxu4/boot.ini new file +5 -0
new file mode 100644
index 0000000..8a83a1a
@@ -0,0 +1,5 @@
+ODROIDXU-UBOOT-CONFIG
+ 
+load mmc 0:1 0x44000000 'boot.scr'
+source 0x44000000
+
board/hardkernel/odroidxu4/genimage.cfg new file +28 -0
new file mode 100644
index 0000000..13d71cc
@@ -0,0 +1,28 @@
+image boot.vfat {
+	vfat {
+		files = {
+			"boot.ini",
+			"boot.scr",
+			"zImage",
+			"exynos5422-odroidxu4.dtb"
+		}
+	}
+	size = 129M
+}
+
+image sdcard.img {
+	hdimage {
+	}
+
+	partition vfat {
+		partition-type = 0xC
+		image = "boot.vfat"
+		offset = 2097152
+	}
+
+	partition rootfs {
+		partition-type = 0x83
+		image = "rootfs.ext4"
+		size = 1024M
+	}
+}
board/hardkernel/odroidxu4/genimage_bootloader_fragment.cfg new file +29 -0
new file mode 100644
index 0000000..a8e8379
@@ -0,0 +1,29 @@
+	partition bl1 {
+		in-partition-table = "no"
+		image = "bl1.bin.hardkernel"
+		offset = 512
+		size = 15358
+	}
+
+	partition bl2 {
+		in-partition-table = "no"
+		image = "bl2.bin.hardkernel.720k_uboot"
+		offset = 15872
+		size = 16384
+	}
+
+	partition u-boot {
+		in-partition-table = "no"
+		image = "u-boot-dtb.bin"
+		offset = 32256
+		size = 720k
+	}
+
+	partition tzsw {
+		in-partition-table = "no"
+		image = "tzsw.bin.hardkernel"
+		offset = 769536
+		size = 256k
+	}
+
+
board/hardkernel/odroidxu4/post-image.sh new file +50 -0

50 lines not on this page · raw message

board/hardkernel/odroidxu4/readme.txt new file +76 -0

76 lines not on this page · raw message

configs/odroidxu4_defconfig new file +28 -0
new file mode 100644
index 0000000..9feef3e
@@ -0,0 +1,28 @@
+BR2_arm=y
+BR2_cortex_a7=y
+BR2_PACKAGE_HOST_LINUX_HEADERS_CUSTOM_4_9=y
+BR2_ROOTFS_POST_IMAGE_SCRIPT="board/hardkernel/odroidxu4/post-image.sh"
+BR2_LINUX_KERNEL=y
+BR2_LINUX_KERNEL_CUSTOM_TARBALL=y
+BR2_LINUX_KERNEL_CUSTOM_TARBALL_LOCATION="https://github.com/hardkernel/linux/archive/jenkins-deb_kernel_5422_4.9-73.tar.gz"
+BR2_LINUX_KERNEL_DEFCONFIG="odroidxu4"
+BR2_LINUX_KERNEL_DTS_SUPPORT=y
+BR2_LINUX_KERNEL_INTREE_DTS_NAME="exynos5422-odroidxu4"
+BR2_LINUX_KERNEL_INSTALL_TARGET=y
+BR2_TARGET_ROOTFS_EXT2=y
+BR2_TARGET_ROOTFS_EXT2_4=y
+BR2_TARGET_ROOTFS_EXT2_SIZE="1024M"
+# BR2_TARGET_ROOTFS_TAR is not set
+BR2_TARGET_UBOOT=y
+BR2_TARGET_UBOOT_BUILD_SYSTEM_KCONFIG=y
+BR2_TARGET_UBOOT_CUSTOM_GIT=y
+BR2_TARGET_UBOOT_CUSTOM_REPO_URL="https://github.com/hardkernel/u-boot.git"
+BR2_TARGET_UBOOT_CUSTOM_REPO_VERSION="88af53fbcef8386cb4d5f04c19f4b2bcb69e90ca"
+BR2_TARGET_UBOOT_BOARD_DEFCONFIG="odroid-xu4"
+BR2_TARGET_UBOOT_NEEDS_DTC=y
+BR2_TARGET_UBOOT_FORMAT_DTB_BIN=y
+BR2_TARGET_UBOOT_SPL=y
+BR2_TARGET_UBOOT_SPL_NAME="sd_fuse/bl1.bin.hardkernel sd_fuse/bl2.bin.hardkernel.720k_uboot sd_fuse/tzsw.bin.hardkernel "
+BR2_TARGET_UBOOT_BOOT_SCRIPT=y
+BR2_TARGET_UBOOT_BOOT_SCRIPT_SOURCE="board/hardkernel/odroidxu4/boot.cmd"
+BR2_PACKAGE_HOST_GENIMAGE=y
Signature · 1 line
2.7.4
#1 lore raw

PATCH 1/1 Odroid XU4: Hardkernel new board support

Hello Pierre,

Quoted 6 lines · Pierre CROKAERT

This patch provides support for the board Odroid XU4
This version is using the latest 4.9 kernel released by Hardkernel,
and the current u-boot 2017.05 also from Hardkernel.
The support was implemented based on comments about Andi's patch (https://patchwork.ozlabs.org/patch/640695/).

Thanks for working on this topic. However, there are still a few things that I don't understand and/or that don't feel correct.

Quoted 6 lines
board/hardkernel/odroidxu4/boot.cmd new file +0 -0
new file mode 100644
index 0000000..2fb4c16

board/hardkernel/odroidxu4/boot.cmd line 9

Quoted 9 lines
board/hardkernel/odroidxu4/boot.cmd new file +9 -0
@@ -0,0 +1,10 @@
+setenv kernelname zImage;
+setenv boot_kernel "setenv bootargs \"${console} root=/dev/mmcblk${mmcrootdev}p${mmcrootpart} rootfstype=${rootfstype} rootwait ${opts}\";
+load mmc ${mmcbootdev}:${mmcbootpart} 0x40007FC0 '${kernelname}';
+if load mmc ${mmcbootdev}:${mmcbootpart} 40800000 ${fdtfile}; then
+	bootz 0x40007FC0 - 40800000;
+else
+	echo Warning! Booting without DTB: '${fdtfile}'!;
+	bootz 0x40007FC0 -;
+fi;"

Is this condition really needed? Aren't you always going to boot with a DTB ?

board/hardkernel/odroidxu4/boot.cmd line 10

Quoted 2 lines
board/hardkernel/odroidxu4/boot.cmd new file +1 -0
+run boot_kernel;
\ No newline at end of file

Nit: please add a new line here.

board/hardkernel/odroidxu4/genimage_bootloader_fragment.cfg

Quoted 5 lines
board/hardkernel/odroidxu4/genimage_bootloader_fragment.cfg new file +0 -0
new file mode 100644
index 0000000..a8e8379

I don't see this file being used anywhere. Why isn't this done in genimage.cfg itself ?

Quoted 15 lines
board/hardkernel/odroidxu4/post-image.sh new file +9 -0
new file mode 100755
index 0000000..1722c4b
@@ -0,0 +1,50 @@
+#!/bin/sh
+
+BOARD_DIR="$(dirname $0)"
+GENIMAGE_CFG="${BOARD_DIR}/genimage.cfg"
+GENIMAGE_TMP="${BUILD_DIR}/genimage.tmp"
+
+cp ${BOARD_DIR}/boot.ini ${BINARIES_DIR}/
+
+rm -rf "${GENIMAGE_TMP}"

board/hardkernel/odroidxu4/post-image.sh line 19

Quoted 10 lines
board/hardkernel/odroidxu4/post-image.sh new file +10 -0
+
+genimage                           \
+	--rootpath "${TARGET_DIR}"     \
+	--tmppath "${GENIMAGE_TMP}"    \
+	--inputpath "${BINARIES_DIR}"  \
+	--outputpath "${BINARIES_DIR}" \
+	--config "${GENIMAGE_CFG}"
+
+#dd if=${BINARIES_DIR}/u-boot.bin of=${BINARIES_DIR}/sdcard.img bs=1 count=442 conv=sync,notrunc
+#dd if=${BINARIES_DIR}/u-boot.bin of=${BINARIES_DIR}/sdcard.img bs=512 skip=1 seek=1 conv=fsync,notrunc

Those lines are commented, they should be removed.

Quoted 19 lines
board/hardkernel/odroidxu4/post-image.sh new file +19 -0
+
+signed_bl1_position=0
+bl2_position=30
+uboot_position=62
+tzsw_position=1502
+device="${BINARIES_DIR}/sdcard.img"
+uboot="${BINARIES_DIR}/u-boot-dtb.bin"
+
+env_position=2015
+
+#<BL1 fusing>
+echo "BL1 fusing"
+dd if=${BINARIES_DIR}/bl1.bin.hardkernel of=$device seek=$signed_bl1_position conv=fsync,notrunc
+
+#<BL2 fusing>
+echo "BL2 fusing"
+dd if=${BINARIES_DIR}/bl2.bin.hardkernel.720k_uboot of=$device seek=$bl2_position conv=fsync,notrunc
+
+#<u-boot fusing>

board/hardkernel/odroidxu4/post-image.sh line 48

Quoted 10 lines
board/hardkernel/odroidxu4/post-image.sh new file +10 -0
+echo "u-boot fusing"
+dd if=$uboot of=$device seek=$uboot_position conv=fsync,notrunc
+
+#<TrustZone S/W fusing>
+echo "TrustZone S/W fusing"
+dd if=${BINARIES_DIR}/tzsw.bin.hardkernel of=$device seek=$tzsw_position conv=fsync,notrunc
+
+#<u-boot env erase>
+echo "u-boot env erase..."
+dd if=/dev/zero of=$device seek=$env_position bs=512 count=32 conv=fsync,notrunc

Why are you doing all those dd invocations here instead of using a genimage configuration file that will put all those images at the right offset in the SD card image ?

Quoted 34 lines
board/hardkernel/odroidxu4/readme.txt new file +28 -0
new file mode 100644
index 0000000..24a0184
@@ -0,0 +1,76 @@
+Odroid XU-4 board with Samsung Exynos 5422 SoC
+
+Introduction
+------------
+
+The Odroid XU 4 board is developed and shipped by Hrdkernel (hardkernel.com). It
+uses the Samsung Exynos 5422 Soc.
+
+Odroid boot process
+-------------------
+
+The odroid boot process requires three stages of boot plus trust zone:
+
+    boot level 1
+
+        |
+        V
+
+    boot level 2
+
+        |
+        V
+
+     u-boot
+
+and they need to be raw copied to the SD card in the following order:
+
+    +----------------+----------------+

board/hardkernel/odroidxu4/readme.txt line 38

Quoted 10 lines
board/hardkernel/odroidxu4/readme.txt new file +10 -0
+    | boot level 1   | 1 block        |
+    +----------------+----------------+
+    | boot level 2   | 31 block       |
+    +----------------+----------------+
+    | u-boot         | 63 block       |
+    +----------------+----------------+
+    | trust zone     | 2111 block     |
+    +----------------+----------------+
+    | boot partition | 4096 block     |
+    +----------------+----------------+

Are those "1 block", "31 block", etc. information the offset or the size of each part ?

Do we really need this explained in the readme.txt, if the genimage.cfg file already documents that ?

Thanks!

Thomas

Signature · 3 lines
Thomas Petazzoni, CTO, Bootlin (formerly Free Electrons)
Embedded Linux and Kernel engineering
http://bootlin.com
#2 lore raw

PATCH 1/1 Odroid XU4: Hardkernel new board support

Hello Thomas,

Thank you for the quick feedback. My reply in the text:

2018-02-14 22:41 GMT+01:00 Thomas Petazzoni <[email protected]>:

Quoted 25 lines

Hello Pierre,

Quoted 4 lines · Pierre CROKAERT

This patch provides support for the board Odroid XU4 This version is using the latest 4.9 kernel released by Hardkernel, and the current u-boot 2017.05 also from Hardkernel.
The support was implemented based on comments about Andi's patch (

https://patchwork.ozlabs.org/patch/640695/).

Quoted 2 lines

Thanks for working on this topic. However, there are still a few things that I don't understand and/or that don't feel correct.

Review

Quoted 1 line
(quoted diff) +0 -0

b/board/hardkernel/odroidxu4/boot.cmd

board/hardkernel/odroidxu4/boot.cmd line 2

Quoted 7 lines

new file mode 100644
index 0000000..2fb4c16

board/hardkernel/odroidxu4/boot.cmd new file +2 -0
@@ -0,0 +1,10 @@
+setenv kernelname zImage;
+setenv boot_kernel "setenv bootargs \"${console}

root=/dev/mmcblk${mmcrootdev}p${mmcrootpart} rootfstype=${rootfstype} rootwait ${opts}\";

Quoted 11 lines

board/hardkernel/odroidxu4/boot.cmd line 9

Quoted 7 lines
board/hardkernel/odroidxu4/boot.cmd new file +7 -0
+load mmc ${mmcbootdev}:${mmcbootpart} 0x40007FC0 '${kernelname}';
+if load mmc ${mmcbootdev}:${mmcbootpart} 40800000 ${fdtfile}; then
+     bootz 0x40007FC0 - 40800000;
+else
+     echo Warning! Booting without DTB: '${fdtfile}'!;
+     bootz 0x40007FC0 -;
+fi;"

Is this condition really needed? Aren't you always going to boot with a DTB ?

Yes, in this buildroot context, the DTB will always be present. I can remove these lines.
In the meantime, I have removed the boot.cmd and replaced it by a boot.ini that is required to adjust some platform parameters (video,..). Should I update the patch already or fix your comments first?

Quoted 6 lines

board/hardkernel/odroidxu4/boot.cmd line 10

Quoted 3 lines
board/hardkernel/odroidxu4/boot.cmd new file +1 -0
+run boot_kernel;
\ No newline at end of file

Nit: please add a new line here.

Ok

Quoted 11 lines

Review

Quoted 2 lines
(quoted diff) +0 -0

b/board/hardkernel/odroidxu4/genimage_bootloader_fragment.cfg

board/hardkernel/odroidxu4/genimage_bootloader_fragment.cfg

Quoted 4 lines

new file mode 100644
index 0000000..a8e8379

board/hardkernel/odroidxu4/genimage_bootloader_fragment.cfg new file +0 -0

I don't see this file being used anywhere. Why isn't this done in genimage.cfg itself ?

This is actually not used, I have tried to put everything in the genimage file, but I have a problem with the boot loader part. Hardkernel provides 3 binary files via there uboot github site, the problem is that the first 2 files actually overlap when you flash them, the second one (bl2.bin) overlaps the first one (bl1.bin). I have described this in an issue on github, but there is no reaction:
https://github.com/hardkernel/u-boot/issues/45
I suppose the end of bl1.bin is erased by bl2.bin and it works, but this is black box.
Because of this overlap, genimage complains that there there is not enough room for the first file (bl1.bin).
This is why I have used the "dd" command to flash all the bootloader files. This genimage_bootloader_fragment.cfg is the part that should go in the genimage.cfg file if the blX.bin files were fixed.
Do you prefere to remove this file for now?

Quoted 27 lines

Review

Quoted 2 lines
(quoted diff) +0 -0

b/board/hardkernel/odroidxu4/post-image.sh

Quoted 13 lines

new file mode 100755
index 0000000..1722c4b

board/hardkernel/odroidxu4/post-image.sh new file +8 -0
@@ -0,0 +1,50 @@
+#!/bin/sh
+
+BOARD_DIR="$(dirname $0)"
+GENIMAGE_CFG="${BOARD_DIR}/genimage.cfg"
+GENIMAGE_TMP="${BUILD_DIR}/genimage.tmp"
+
+cp ${BOARD_DIR}/boot.ini ${BINARIES_DIR}/
+

board/hardkernel/odroidxu4/post-image.sh line 18

Quoted 10 lines
board/hardkernel/odroidxu4/post-image.sh new file +10 -0
+rm -rf "${GENIMAGE_TMP}"
+
+genimage                           \
+     --rootpath "${TARGET_DIR}"     \
+     --tmppath "${GENIMAGE_TMP}"    \
+     --inputpath "${BINARIES_DIR}"  \
+     --outputpath "${BINARIES_DIR}" \
+     --config "${GENIMAGE_CFG}"
+
+#dd if=${BINARIES_DIR}/u-boot.bin of=${BINARIES_DIR}/sdcard.img bs=1

count=442 conv=sync,notrunc

Quoted 5 lines

board/hardkernel/odroidxu4/post-image.sh line 19

Quoted 1 line
board/hardkernel/odroidxu4/post-image.sh new file +1 -0
+#dd if=${BINARIES_DIR}/u-boot.bin of=${BINARIES_DIR}/sdcard.img bs=512

skip=1 seek=1 conv=fsync,notrunc

Those lines are commented, they should be removed.

Ok.

Quoted 35 lines
Quoted 4 lines
board/hardkernel/odroidxu4/post-image.sh new file +3 -0
+
+signed_bl1_position=0
+bl2_position=30

board/hardkernel/odroidxu4/post-image.sh

Quoted 10 lines
board/hardkernel/odroidxu4/post-image.sh new file +10 -0
+uboot_position=62
+tzsw_position=1502
+device="${BINARIES_DIR}/sdcard.img"
+uboot="${BINARIES_DIR}/u-boot-dtb.bin"
+
+env_position=2015
+
+#<BL1 fusing>
+echo "BL1 fusing"
+dd if=${BINARIES_DIR}/bl1.bin.hardkernel of=$device

seek=$signed_bl1_position conv=fsync,notrunc

board/hardkernel/odroidxu4/post-image.sh

Quoted 4 lines
board/hardkernel/odroidxu4/post-image.sh new file +4 -0
+
+#<BL2 fusing>
+echo "BL2 fusing"
+dd if=${BINARIES_DIR}/bl2.bin.hardkernel.720k_uboot of=$device

seek=$bl2_position conv=fsync,notrunc

board/hardkernel/odroidxu4/post-image.sh

Quoted 8 lines
board/hardkernel/odroidxu4/post-image.sh new file +8 -0
+
+#<u-boot fusing>
+echo "u-boot fusing"
+dd if=$uboot of=$device seek=$uboot_position conv=fsync,notrunc
+
+#<TrustZone S/W fusing>
+echo "TrustZone S/W fusing"
+dd if=${BINARIES_DIR}/tzsw.bin.hardkernel of=$device

seek=$tzsw_position conv=fsync,notrunc

board/hardkernel/odroidxu4/post-image.sh

Quoted 4 lines
board/hardkernel/odroidxu4/post-image.sh new file +4 -0
+
+#<u-boot env erase>
+echo "u-boot env erase..."
+dd if=/dev/zero of=$device seek=$env_position bs=512 count=32

conv=fsync,notrunc

Quoted 4 lines

Why are you doing all those dd invocations here instead of using a genimage configuration file that will put all those images at the right offset in the SD card image ?

Related to the bl1, bl2 files issue.

Quoted 51 lines

Review

Quoted 2 lines
(quoted diff) +0 -0

b/board/hardkernel/odroidxu4/readme.txt

board/hardkernel/odroidxu4/readme.txt line 6

Quoted 11 lines

new file mode 100644
index 0000000..24a0184

board/hardkernel/odroidxu4/readme.txt new file +6 -0
@@ -0,0 +1,76 @@
+Odroid XU-4 board with Samsung Exynos 5422 SoC
+
+Introduction
+------------
+
+The Odroid XU 4 board is developed and shipped by Hrdkernel (

hardkernel.com). It

Quoted 22 lines
board/hardkernel/odroidxu4/readme.txt new file +22 -0
+uses the Samsung Exynos 5422 Soc.
+
+Odroid boot process
+-------------------
+
+The odroid boot process requires three stages of boot plus trust zone:
+
+    boot level 1
+
+        |
+        V
+
+    boot level 2
+
+        |
+        V
+
+     u-boot
+
+and they need to be raw copied to the SD card in the following order:
+
+    +----------------+----------------+

board/hardkernel/odroidxu4/readme.txt line 38

Quoted 10 lines
board/hardkernel/odroidxu4/readme.txt new file +10 -0
+    | boot level 1   | 1 block        |
+    +----------------+----------------+
+    | boot level 2   | 31 block       |
+    +----------------+----------------+
+    | u-boot         | 63 block       |
+    +----------------+----------------+
+    | trust zone     | 2111 block     |
+    +----------------+----------------+
+    | boot partition | 4096 block     |
+    +----------------+----------------+

Are those "1 block", "31 block", etc. information the offset or the size of each part ?

Quoted 3 lines

Do we really need this explained in the readme.txt, if the genimage.cfg file already documents that ?

Right, this could be removed, it is historical but useless.

Quoted 9 lines

Thanks!

Thomas
--
Thomas Petazzoni, CTO, Bootlin (formerly Free Electrons) Embedded Linux and Kernel engineering
http://bootlin.com

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.busybox.net/pipermail/buildroot/attachments/20180215/017d79f3/attachment.html>

#3 lore raw

PATCH 1/1 Odroid XU4: Hardkernel new board support

Hello,

Quoted 8 lines · Pierre Crokaert
Quoted 2 lines

Is this condition really needed? Aren't you always going to boot with a DTB ?

Yes, in this buildroot context, the DTB will always be present. I can remove these lines.
In the meantime, I have removed the boot.cmd and replaced it by a boot.ini that is required to adjust some platform parameters (video,..). Should I update the patch already or fix your comments first?

It would be better to fix all comments.

Quoted 7 lines

This is actually not used, I have tried to put everything in the genimage file, but I have a problem with the boot loader part. Hardkernel provides 3 binary files via there uboot github site, the problem is that the first 2 files actually overlap when you flash them, the second one (bl2.bin) overlaps the first one (bl1.bin). I have described this in an issue on github, but there is no reaction:
https://github.com/hardkernel/u-boot/issues/45

Quoted 8 lines

I suppose the end of bl1.bin is erased by bl2.bin and it works, but this is black box.
Because of this overlap, genimage complains that there there is not enough room for the first file (bl1.bin).
This is why I have used the "dd" command to flash all the bootloader files. This genimage_bootloader_fragment.cfg is the part that should go in the genimage.cfg file if the blX.bin files were fixed.
Do you prefere to remove this file for now?

OK, I understand the problem (it would have been good to explain it in the commit log!). Since you say that overwriting bl1.bin with bl2 works fine, then what I suggest is that in your post-build script, you do something like this:

	truncate -s 15360 $(BINARIES_DIR)/bl1.bin

Then, you can use genimage correctly for everything, including the bootloader parts. Of course, please add a comment above this "truncate" line which explains the problem, and points to
https://github.com/hardkernel/u-boot/issues/45.

Thanks!

Thomas

Signature · 3 lines
Thomas Petazzoni, CTO, Bootlin (formerly Free Electrons)
Embedded Linux and Kernel engineering
http://bootlin.com
#4 lore raw

PATCH v2 1/1 Odroid XU4: Hardkernel new board support

This patch provides support for the board Odroid XU4
This version is using a recent 4.14 kernel released by Hardkernel,
and the current u-boot 2017.05 also from Hardkernel.
The support was implemented based on comments about Andi's patch (https://patchwork.ozlabs.org/patch/640695/).

---
I made all the modifications we discussed.
I have also changed the kernel branch to use the latest branch maintained by Hardkernel. This patch also includes to replacement of boot.cmd by boot.ini.
I think it is a better start to support the OdroidXU4 board.

 board/hardkernel/odroidxu4/boot.ini      | 197 +++++++++++++++++++++++++++++++
 board/hardkernel/odroidxu4/genimage.cfg  |  55 +++++++++
 board/hardkernel/odroidxu4/post-image.sh |  24 ++++
 board/hardkernel/odroidxu4/readme.txt    |  37 ++++++
 configs/odroidxu4_defconfig              |  25 ++++
 5 files changed, 338 insertions(+)
 create mode 100644 board/hardkernel/odroidxu4/boot.ini
 create mode 100644 board/hardkernel/odroidxu4/genimage.cfg
 create mode 100755 board/hardkernel/odroidxu4/post-image.sh
 create mode 100644 board/hardkernel/odroidxu4/readme.txt
 create mode 100644 configs/odroidxu4_defconfig
board/hardkernel/odroidxu4/boot.ini new file +197 -0
new file mode 100644
index 0000000..a4d007e
@@ -0,0 +1,197 @@
+ODROIDXU-UBOOT-CONFIG
+
+# U-Boot Parameters
+setenv initrd_high "0xffffffff"
+setenv fdt_high "0xffffffff"
+
+# Mac address configuration
+setenv macaddr "00:1e:06:61:7a:39"
+
+#------------------------------------------------------------------------------------------------------
+# Basic Ubuntu Setup. Don't touch unless you know what you are doing.
+# --------------------------------
+setenv bootrootfs "console=tty1 root=/dev/mmcblk1p2 rootwait rw fsck.repair=yes net.ifnames=0"
+
+# boot commands
+setenv bootcmd "load mmc 0:1 0x40008000 zImage; load mmc 0:1 0x44000000 exynos5422-odroidxu4.dtb; bootz 0x40008000 - 0x44000000"
+
+# --- Screen Configuration for HDMI --- # 
+# ---------------------------------------
+# Uncomment only ONE line! Leave all commented for automatic selection.
+# Uncomment only the setenv line!
+# ---------------------------------------
+# ODROID-VU forced resolution
+# setenv videoconfig "video=HDMI-A-1:1280x800 at 60"
+# -----------------------------------------------
+# ODROID-VU forced EDID
+# setenv videoconfig "drm_kms_helper.edid_firmware=edid/1280x800.bin"
+# -----------------------------------------------
+# 1920x1080 (1080P) with monitor provided EDID information. (1080p-edid)
+# setenv videoconfig "video=HDMI-A-1:1920x1080 at 60"
+# -----------------------------------------------
+# 1920x1080 (1080P) without monitor data using generic information (1080p-noedid)
+# setenv videoconfig "drm_kms_helper.edid_firmware=edid/1920x1080.bin"
+# -----------------------------------------------
+# 1920x1080 50hz (1080P) with monitor provided EDID information. (1080p 50hz-edid)
+# setenv videoconfig "video=HDMI-A-1:1920x1080 at 50"
+# -----------------------------------------------
+# 1920x1080 50hz (1080P) without monitor data using generic information (1080p 50hz-noedid)
+# setenv videoconfig "drm_kms_helper.edid_firmware=edid/1920x1080_50hz.bin"
+# -----------------------------------------------
+# 1440x900 with monitor provided EDID information.
+# setenv videoconfig "video=HDMI-A-1:1440x900 at 60"
+# -----------------------------------------------
+# 1440x900 without monitor data using generic information 
+# setenv videoconfig "drm_kms_helper.edid_firmware=edid/1440x900.bin"
+# -----------------------------------------------
+# 1280x720 (720P) with monitor provided EDID information. (720p-edid)
+# setenv videoconfig "video=HDMI-A-1:1280x720 at 60"
+# -----------------------------------------------
+# 1280x720 (720P) without monitor data using generic information (720p-noedid)
+# setenv videoconfig "drm_kms_helper.edid_firmware=edid/1280x720.bin"
+# -----------------------------------------------
+# 1024x768 without monitor data using generic information
+# setenv videoconfig "drm_kms_helper.edid_firmware=edid/1024x768.bin"
+# -----------------------------------------------
+# 800x600 without monitor data using generic information 
+# setenv videoconfig "drm_kms_helper.edid_firmware=edid/800x600.bin"
+# -----------------------------------------------
+# 800x480 without monitor data using generic information (ODROID 7")
+# setenv videoconfig "drm_kms_helper.edid_firmware=edid/800x480.bin"
+# -----------------------------------------------
+# 720x576 without monitor data using generic information 
+# setenv videoconfig "drm_kms_helper.edid_firmware=edid/720x576.bin"
+# -----------------------------------------------
+# 720x480 without monitor data using generic information 
+# setenv videoconfig "drm_kms_helper.edid_firmware=edid/720x480.bin"
+# -----------------------------------------------
+# 640x480 without monitor data using generic information
+# setenv videoconfig "drm_kms_helper.edid_firmware=edid/640x480.bin"
+
+
+# --- HDMI / DVI Mode Selection ---
+# ------------------------------------------
+# - HDMI Mode
+setenv vout "hdmi"
+# - DVI Mode (disables sound over HDMI as per DVI compat)
+# setenv vout "dvi"
+
+
+# --- CPU Governor Setup ---
+# Uncomment only one line. New governor is set after 90secs after boot.
+# ------------------------------------------
+# - Performance (Keep all the CPU's at Maximum frequency)
+setenv governor "performance"
+# ------------------------------------------
+# - Ondemand
+# setenv governor "ondemand"
+# ------------------------------------------
+# - Interactive (Pretty much just like ondemand with more possible customization via sysfs.)
+# setenv governor "interactive"
+# ------------------------------------------
+# - Conservative (Like ondemand, but do the frequency transitions more slowly, great for battery powered applications)
+# setenv governor "conservative"
+# ------------------------------------------
+# - Powersave (Keeps the CPU's to the lowest possible temps)
+# setenv governor "powersave"
+
+
+#------------------------------------------------------------------------------
+#
+# HDMI-PHY Parameter Control
+#
+#------------------------------------------------------------------------------
+#------------------------------------------------------------------------------
+#
+# HDMI Hot Plug detection
+#
+#------------------------------------------------------------------------------
+#
+# Forces the HDMI subsystem to ignore the check if the cable is connected or 
+# not.
+# false : disable the detection and force it as connected.
+# true : let cable, board and monitor decide the connection status.
+# 
+# default: true
+# 
+#------------------------------------------------------------------------------
+setenv HPD "true"
+
+#------------------------------------------------------------------------------
+#
+#  TMDS data amplitude control.
+#
+#------------------------------------------------------------------------------
+#
+#  1LSB corresponds to 20 mVdiff amplitude level.
+#  tx_amp_lvl : 0 = 760 mVdiff(Min), 31 = 1380 mVdiff(Max)
+#
+#  Hardkernel default hdmi_tx_amp_lvl = 31(1380 mVdiff);
+#------------------------------------------------------------------------------
+setenv hdmi_tx_amp_lvl  "31"
+
+#------------------------------------------------------------------------------
+#
+#  TMDS data amplitude fine control for each channel.
+#
+#------------------------------------------------------------------------------
+#
+#  1LSB corresponds to 20 mVdiff amplitude level.
+#  tx_lvl : 0 = 0 mVdiff(Min), 3 = 60 mVdiff(Max)
+#
+#  Hardkernel default
+#      hdmi_tx_lvl_ch0 = 3, hdmi_tx_lvl_ch1 = 3, hdmi_tx_lvl_ch2 = 3,
+#------------------------------------------------------------------------------
+setenv hdmi_tx_lvl_ch0      "3"
+setenv hdmi_tx_lvl_ch1      "3"
+setenv hdmi_tx_lvl_ch2      "3"
+
+#------------------------------------------------------------------------------
+#
+#  TMDS data pre-emphasis level control.
+#
+#------------------------------------------------------------------------------
+#
+#  1LSB corresponds to -0.45dB emphasis level except for 1
+#  tx_emp_lvl : 0 = 0 db(Min), 1 = -0.25 db, 2 = 0.7 db, 15 = -7.45 db(Max)
+#
+#  Hardkernel default hdmi_tx_emp_lvl = 6 (-2.50 db);
+#------------------------------------------------------------------------------
+setenv hdmi_tx_emp_lvl      "6"
+
+#------------------------------------------------------------------------------
+#
+#  TMDS clock amplitude control.
+#
+#------------------------------------------------------------------------------
+#
+#  1LSB corresponds to 20 mVdiff amplitude level.
+#  clk_amp_lvl : 0 = 790 mVdiff(Min), 31 = 1410 mVdiff(Max)
+#
+#  Hardkernel default hdmi_clk_amp_lvl = 31 (1410 mVdiff)
+#------------------------------------------------------------------------------
+setenv hdmi_clk_amp_lvl     "31"
+
+#------------------------------------------------------------------------------
+#
+#  TMDS data source termination resistor control.
+#
+#------------------------------------------------------------------------------
+#
+#  tx_res :
+#      0 = Source Termination OFF(Min), 1 = 200 ohm, 2 = 300 ohm, 3 = 120 ohm(Max)
+#
+#  Hardkernrel default hdmi_tx_res = 0 (Source Termination OFF)
+#------------------------------------------------------------------------------
+setenv hdmi_tx_res      "0"
+
+#------------------------------------------------------------------------------
+
+setenv hdmi_phy_control "hdmi_tx_amp_lvl=${hdmi_tx_amp_lvl} hdmi_tx_lvl_ch0=${hdmi_tx_lvl_ch0} hdmi_tx_lvl_ch1=${hdmi_tx_lvl_ch1} hdmi_tx_lvl_ch2=${hdmi_tx_lvl_ch2} hdmi_tx_emp_lvl=${hdmi_tx_emp_lvl} hdmi_clk_amp_lvl=${hdmi_clk_amp_lvl} hdmi_tx_res=${hdmi_tx_res} HPD=${HPD} vout=${vout}"
+
+# final boot args
+setenv bootargs "${bootrootfs} ${videoconfig} smsc95xx.macaddr=${macaddr} governor=${governor} ${hdmi_phy_control}"
+# drm.debug=0xff
+# Boot the board
+boot
+
board/hardkernel/odroidxu4/genimage.cfg new file +55 -0

55 lines not on this page · raw message

board/hardkernel/odroidxu4/post-image.sh new file +24 -0
new file mode 100755
index 0000000..025906c
@@ -0,0 +1,24 @@
+#!/bin/sh
+
+BOARD_DIR="$(dirname $0)"
+GENIMAGE_CFG="${BOARD_DIR}/genimage.cfg"
+GENIMAGE_TMP="${BUILD_DIR}/genimage.tmp"
+
+cp ${BOARD_DIR}/boot.ini ${BINARIES_DIR}/
+
+# The bl1.bin.hardkernel file provided by the uboot hardkernel repository is overwritten
+# by the bl2.bin.hardkernel in the sd_fusing.sh script because it is too big.
+# In order to implement this in genimage, we need to truncate the bl1.bin file
+# so that it does not exceed the available place.
+# An issue has been filled about this: https://github.com/hardkernel/u-boot/issues/45
+truncate -s 15360 ${BINARIES_DIR}/bl1.bin.hardkernel
+
+rm -rf "${GENIMAGE_TMP}"
+
+genimage                           \
+	--rootpath "${TARGET_DIR}"     \
+	--tmppath "${GENIMAGE_TMP}"    \
+	--inputpath "${BINARIES_DIR}"  \
+	--outputpath "${BINARIES_DIR}" \
+	--config "${GENIMAGE_CFG}"
+
board/hardkernel/odroidxu4/readme.txt new file +37 -0
new file mode 100644
index 0000000..e3cba8b
@@ -0,0 +1,37 @@
+Odroid XU-4 board with Samsung Exynos 5422 SoC
+
+How to build it
+===============
+
+  $ make odroidxu4_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 all output files in output/images/
+
+
+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-XU4, and power it up. Your new system
+should come up now.
+
configs/odroidxu4_defconfig new file +25 -0
new file mode 100644
index 0000000..f457b05
@@ -0,0 +1,25 @@
+BR2_arm=y
+BR2_cortex_a7=y
+BR2_ROOTFS_POST_IMAGE_SCRIPT="board/hardkernel/odroidxu4/post-image.sh"
+BR2_LINUX_KERNEL=y
+BR2_LINUX_KERNEL_CUSTOM_GIT=y
+BR2_LINUX_KERNEL_CUSTOM_REPO_URL="https://github.com/hardkernel/linux.git"
+BR2_LINUX_KERNEL_CUSTOM_REPO_VERSION="4.14.16-104"
+BR2_LINUX_KERNEL_DEFCONFIG="odroidxu4"
+BR2_LINUX_KERNEL_DTS_SUPPORT=y
+BR2_LINUX_KERNEL_INTREE_DTS_NAME="exynos5422-odroidxu4"
+BR2_TARGET_ROOTFS_EXT2=y
+BR2_TARGET_ROOTFS_EXT2_4=y
+BR2_TARGET_ROOTFS_EXT2_SIZE="1024M"
+# BR2_TARGET_ROOTFS_TAR is not set
+BR2_TARGET_UBOOT=y
+BR2_TARGET_UBOOT_BUILD_SYSTEM_KCONFIG=y
+BR2_TARGET_UBOOT_CUSTOM_GIT=y
+BR2_TARGET_UBOOT_CUSTOM_REPO_URL="https://github.com/hardkernel/u-boot.git"
+BR2_TARGET_UBOOT_CUSTOM_REPO_VERSION="88af53fbcef8386cb4d5f04c19f4b2bcb69e90ca"
+BR2_TARGET_UBOOT_BOARD_DEFCONFIG="odroid-xu4"
+BR2_TARGET_UBOOT_NEEDS_DTC=y
+BR2_TARGET_UBOOT_FORMAT_DTB_BIN=y
+BR2_TARGET_UBOOT_SPL=y
+BR2_TARGET_UBOOT_SPL_NAME="sd_fuse/bl1.bin.hardkernel sd_fuse/bl2.bin.hardkernel.720k_uboot sd_fuse/tzsw.bin.hardkernel "
+BR2_PACKAGE_HOST_GENIMAGE=y
Signature · 1 line
2.7.4
#5 lore raw

PATCH v2 1/1 Odroid XU4: Hardkernel new board support

Hello,

Quoted 11 lines · Pierre CROKAERT

This patch provides support for the board Odroid XU4
This version is using a recent 4.14 kernel released by Hardkernel,
and the current u-boot 2017.05 also from Hardkernel.
The support was implemented based on comments about Andi's patch (https://patchwork.ozlabs.org/patch/640695/).

---
I made all the modifications we discussed.
I have also changed the kernel branch to use the latest branch maintained by Hardkernel. This patch also includes to replacement of boot.cmd by boot.ini.
I think it is a better start to support the OdroidXU4 board.

I have applied to master, with the following changes:

[Thomas:
- Update DEVELOPERS file
- Update .gitlab-ci.yml file
- Simplify the boot.ini script
- Add missing BR2_PACKAGE_HOST_LINUX_HEADERS_CUSTOM_4_14 option
- Add BR2_PACKAGE_HOST_DOSFSTOOLS and BR2_PACKAGE_HOST_MTOOLS since a VFAT filesystem is generated
- Keep the default root filesystem size, since it is sufficient.
- Reduce the size of the VFAT filesystem]

Best regards,

Thomas

Signature · 3 lines
Thomas Petazzoni, CTO, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com
#6 lore raw

PATCH 1/1 Odroid XU4: Hardkernel new board support

In reply to Thomas Petazzoni

Hello Thomas,

I have posted an update including all the changes requested (also using only genimage).
Just needed to do an additional validation and the "truncate" command works. The patch is here: https://patchwork.ozlabs.org/patch/874005/
REM: I don't know exactly when/how to send a new patch in response to a discussed patch so maybe I do something wrong, just tell me if it's the case.

Pierre

2018-02-15 10:51 GMT+01:00 Thomas Petazzoni <[email protected]>:

Quoted 50 lines

Hello,

Quoted 6 lines · Pierre Crokaert
Quoted 2 lines

Is this condition really needed? Aren't you always going to boot with a DTB ?

Yes, in this buildroot context, the DTB will always be present. I can remove these lines.
In the meantime, I have removed the boot.cmd and replaced it by a

boot.ini

Quoted 2 lines

that is required to adjust some platform parameters (video,..). Should I update the patch already or fix your comments first?

It would be better to fix all comments.

Quoted 3 lines

This is actually not used, I have tried to put everything in the genimage file, but I have a problem with the boot loader part. Hardkernel provides 3 binary files via there uboot github site, the

problem

Quoted 1 line

is that the first 2 files actually overlap when you flash them, the

second

Quoted 1 line

one (bl2.bin) overlaps the first one (bl1.bin). I have described this in

an

Quoted 3 lines

issue on github, but there is no reaction:
https://github.com/hardkernel/u-boot/issues/45
I suppose the end of bl1.bin is erased by bl2.bin and it works, but this

is

Quoted 2 lines

black box.
Because of this overlap, genimage complains that there there is not

enough

Quoted 2 lines

room for the first file (bl1.bin).
This is why I have used the "dd" command to flash all the bootloader

files.

Quoted 3 lines

This genimage_bootloader_fragment.cfg is the part that should go in the genimage.cfg file if the blX.bin files were fixed.
Do you prefere to remove this file for now?

OK, I understand the problem (it would have been good to explain it in the commit log!). Since you say that overwriting bl1.bin with bl2 works fine, then what I suggest is that in your post-build script, you do something like this:

        truncate -s 15360 $(BINARIES_DIR)/bl1.bin

Then, you can use genimage correctly for everything, including the bootloader parts. Of course, please add a comment above this "truncate" line which explains the problem, and points to
https://github.com/hardkernel/u-boot/issues/45.

Quoted 8 lines

Thanks!

Thomas
--
Thomas Petazzoni, CTO, Bootlin (formerly Free Electrons) Embedded Linux and Kernel engineering
http://bootlin.com

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.busybox.net/pipermail/buildroot/attachments/20180224/5b1b3d60/attachment.html>