Skip to contentSkip to conversation

Odroid XU4 support

PATCH New Andi Shyti 3 participants 11 messages Jun 26, 2016 – Jun 30, 2016 1 message not in the archive

lore
Share & tools
lore

Andi Shyti

author
#0 lore raw

cover Odroid XU4 support

Hi,

this patchset adds support for the Odroid XU4 board.

The first patch adds the first two stages of boot firmare and the trust zone, necessary to boot the device.

While the second patch adds the actual support of the board.

Andi

Andi Shyti (2):
package: add Odroid BL bootloader binaries
board: add support for the Odroid XU4 board

 board/odroid-xu4/boot.cmd            |  10 +++
 board/odroid-xu4/readme.txt          | 165 +++++++++++++++++++++++++++++++++++
 configs/odroid-xu4_defconfig         |  10 +++
 package/Config.in                    |   1 +
 package/odroid-xu-bl/Config.in       |   6 ++
 package/odroid-xu-bl/odroid-xu-bl.mk |  18 ++++
 6 files changed, 210 insertions(+)
 create mode 100644 board/odroid-xu4/boot.cmd
 create mode 100644 board/odroid-xu4/readme.txt
 create mode 100644 configs/odroid-xu4_defconfig
 create mode 100644 package/odroid-xu-bl/Config.in
 create mode 100644 package/odroid-xu-bl/odroid-xu-bl.mk
Signature · 1 line
2.8.1
author
#1 lore raw

PATCH 1/2 package: add Odroid BL bootloader binaries

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:

	+----------------+----------------+
	| boot level 1   | 1 block        |
	+----------------+----------------+
	| boot level 2   | 31 block       |
	+----------------+----------------+
	| u-boot         | 63 block       |
	+----------------+----------------+
	| trust zone     | 2111 block     |
	+----------------+----------------+
	| boot partition | 4096 block     |
	+----------------+----------------+
	| rootfs         |                |
	+----------------+----------------+

The above files are provided by the hardkernel u-boot from

https://github.com/hardkernel/u-boot/tree/odroidxu3-v2012.07

At the end of the compilation the files will be moved to the output/image directory.

---
 package/Config.in                    |  1 +
 package/odroid-xu-bl/Config.in       |  6 ++++++
 package/odroid-xu-bl/odroid-xu-bl.mk | 18 ++++++++++++++++++
 3 files changed, 25 insertions(+)
 create mode 100644 package/odroid-xu-bl/Config.in
 create mode 100644 package/odroid-xu-bl/odroid-xu-bl.mk
package/Config.in +1 -0
index a2a02a8..a596b7e 100644
@@ -337,6 +337,7 @@ menu "Firmware"
 	source "package/am33x-cm3/Config.in"
 	source "package/b43-firmware/Config.in"
 	source "package/linux-firmware/Config.in"
+	source "package/odroid-xu-bl/Config.in"
 	source "package/rpi-firmware/Config.in"
 	source "package/sunxi-boards/Config.in"
 	source "package/ux500-firmware/Config.in"
package/odroid-xu-bl/Config.in new file +6 -0
new file mode 100644
index 0000000..74d5fe2
@@ -0,0 +1,6 @@
+config BR2_PACKAGE_ODROID_XU_BL
+	bool "odroid-xu-bl"
+	help
+	  Odroid XU3/4 bootloader binaries
+
+	  https://github.com/hardkernel/u-boot/tree/odroidxu3-v2012.07
package/odroid-xu-bl/odroid-xu-bl.mk new file +18 -0
new file mode 100644
index 0000000..68645e9
@@ -0,0 +1,18 @@
+################################################################################
+#
+# odroid-xu-bl
+#
+################################################################################
+
+ODROID_XU_BL_VERSION = odroidxu3-v2012.07
+ODROID_XU_BL_SITE = $(call github,hardkernel,u-boot,$(ODROID_XU_BL_VERSION))
+ODROID_XU_BL_INSTALL_IMAGES = YES
+ODROID_XU_BL_INSTALL_TARGET = NO
+
+define ODROID_XU_BL_INSTALL_IMAGES_CMDS
+	$(INSTALL) -D -m 0644 $(@D)/sd_fuse/hardkernel_1mb_uboot/bl1.bin.hardkernel $(BINARIES_DIR)/bl1.bin.hardkernel
+	$(INSTALL) -D -m 0644 $(@D)/sd_fuse/hardkernel_1mb_uboot/bl2.bin.hardkernel.1mb_uboot $(BINARIES_DIR)/bl2.bin.hardkernel.1mb_uboot
+	$(INSTALL) -D -m 0644 $(@D)/sd_fuse/hardkernel_1mb_uboot/tzsw.bin.hardkernel $(BINARIES_DIR)/tzsw.bin.hardkernel
+endef
+
+$(eval $(generic-package))
Signature · 1 line
2.8.1
#2 lore raw

PATCH 1/2 package: add Odroid BL bootloader binaries

Hello,

Quoted 3 lines · Andi Shyti

The above files are provided by the hardkernel u-boot from

https://github.com/hardkernel/u-boot/tree/odroidxu3-v2012.07

So the source code for those binary files is not available at all?

package/odroid-xu-bl/Config.in line 2

Quoted 2 lines
package/odroid-xu-bl/Config.in new file +2 -0
+config BR2_PACKAGE_ODROID_XU_BL
+	bool "odroid-xu-bl"

depends on BR2_arm

would be good to have here

Also, I think this package should be included in the Bootloaders menu rather than the firmware menu. Maybe we should name it odroid-xu-bootloader or odroid-xu-boot so that it is clear what it does.

package/odroid-xu-bl/odroid-xu-bl.mk line 8

Quoted 10 lines

+++ b/package/odroid-xu-bl/odroid-xu-bl.mk

package/odroid-xu-bl/odroid-xu-bl.mk new file +8 -0
@@ -0,0 +1,18 @@
+################################################################################
+#
+# odroid-xu-bl
+#
+################################################################################
+
+ODROID_XU_BL_VERSION = odroidxu3-v2012.07
+ODROID_XU_BL_SITE = $(call github,hardkernel,u-boot,$(ODROID_XU_BL_VERSION))

It's a bit annoying that we end up downloading an entire U-Boot source tree, and in fact not use it except for those 3 files.

In fact, why don't you simply build this U-Boot version with the U-Boot package that already exists in Buildroot, and then use:

BR2_TARGET_UBOOT_SPL=y
BR2_TARGET_UBOOT_SPL_NAME="sd_fuse/hardkernel_1mb_uboot/bl1.bin.hardkernel sd_fuse/hardkernel_1mb_uboot/bl2.bin.hardkernel.1mb_uboot sd_fuse/hardkernel_1mb_uboot/tzsw.bin.hardkernel"

To ask Buildroot to install the pre-built binaries as if they were SPL images. The only issue is that BR2_TARGET_UBOOT_SPL_NAME currently only installs a single image, but it can easily be changed. And it was actually already proposed in https://patchwork.ozlabs.org/patch/595980/.

Can you investigate such a solution?

Thanks,

Thomas

Signature · 3 lines
Thomas Petazzoni, CTO, Free Electrons
Embedded Linux, Kernel and Android engineering
http://free-electrons.com
author
#3 lore raw

PATCH 1/2 package: add Odroid BL bootloader binaries

Hi Thomas,

Quoted 5 lines
Quoted 3 lines

The above files are provided by the hardkernel u-boot from

https://github.com/hardkernel/u-boot/tree/odroidxu3-v2012.07

So the source code for those binary files is not available at all?

Unfortunately not, it is not even available to me :(

Quoted 6 lines

package/odroid-xu-bl/Config.in line 2

Quoted 2 lines
package/odroid-xu-bl/Config.in new file +2 -0
+config BR2_PACKAGE_ODROID_XU_BL
+	bool "odroid-xu-bl"

depends on BR2_arm

would be good to have here

OK.

Quoted 3 lines

Also, I think this package should be included in the Bootloaders menu rather than the firmware menu. Maybe we should name it odroid-xu-bootloader or odroid-xu-boot so that it is clear what it does.

OK.

Quoted 8 lines

package/odroid-xu-bl/odroid-xu-bl.mk line 8

Quoted 2 lines
package/odroid-xu-bl/odroid-xu-bl.mk new file +2 -0
+ODROID_XU_BL_VERSION = odroidxu3-v2012.07
+ODROID_XU_BL_SITE = $(call github,hardkernel,u-boot,$(ODROID_XU_BL_VERSION))

It's a bit annoying that we end up downloading an entire U-Boot source tree, and in fact not use it except for those 3 files.

In fact, why don't you simply build this U-Boot version with the U-Boot package that already exists in Buildroot, and then use:

It is indeed annoying: I don't like the idea of

1. downloading two u-boot
2. download u-boot for just two files.

But, on the other hand, I don't like the hardkernel u-boot either. I think it's old, ugly and too hacky; as a buildroot user, I would like as much as I can to use mainline software. Besides, the cool thing of this board is that it is well supported both from the Linux Kernel and u-boot.

How about creating a new repository with just these three files? If it sounds good, I will check with the licensing, even though I don't thing it will be a problem.

Thanks a lot,
Andi

A message that is not in the archive (sent off-list or not yet received): [email protected]

#5 lore raw

PATCH 1/2 package: add Odroid BL bootloader binaries

Hello,

Quoted 10 lines · Andi Shyti

It is indeed annoying: I don't like the idea of

1. downloading two u-boot
2. download u-boot for just two files.

But, on the other hand, I don't like the hardkernel u-boot either. I think it's old, ugly and too hacky; as a buildroot user, I would like as much as I can to use mainline software. Besides, the cool thing of this board is that it is well supported both from the Linux Kernel and u-boot.

OK. Indeed, I can understand the value of using a mainline U-Boot, even if you have to use the binary blobs for the first stage bootloader.

Quoted 3 lines

How about creating a new repository with just these three files? If it sounds good, I will check with the licensing, even though I don't thing it will be a problem.

No, we generally don't like to create repositories just for Buildroot. So please keep your new package, possibly with an explanation in the Config.in help text as to why it exists (kind of summarizing the discussion we had).

Thanks a lot!

Thomas

Signature · 3 lines
Thomas Petazzoni, CTO, Free Electrons
Embedded Linux, Kernel and Android engineering
http://free-electrons.com
author
#6 lore raw

PATCH 2/2 board: add support for the Odroid XU4 board

In reply to Andi Shyti

The Odroid XU4 board is released by hardkernel and has a Samsunx 5422 SoC.

The board is supported both by mainline Linux Kernel and mainline u-boot. For the latter a boot.cmd script is provided which needs to be converted to boot.scr

It requires the odroid boot firmware that contains the previous stages of boot earlier than u-boot

---
 board/odroid-xu4/boot.cmd    |  10 +++
 board/odroid-xu4/readme.txt  | 165 +++++++++++++++++++++++++++++++++++++++++++
 configs/odroid-xu4_defconfig |  10 +++
 3 files changed, 185 insertions(+)
 create mode 100644 board/odroid-xu4/boot.cmd
 create mode 100644 board/odroid-xu4/readme.txt
 create mode 100644 configs/odroid-xu4_defconfig
board/odroid-xu4/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/odroid-xu4/readme.txt new file +165 -0

165 lines not on this page · raw message

configs/odroid-xu4_defconfig new file +10 -0
new file mode 100644
index 0000000..5eca993
@@ -0,0 +1,10 @@
+BR2_arm=y
+BR2_cortex_a7=y
+BR2_KERNEL_HEADERS_4_6=y
+BR2_LINUX_KERNEL=y
+BR2_LINUX_KERNEL_DEFCONFIG="exynos"
+BR2_LINUX_KERNEL_DTS_SUPPORT=y
+BR2_LINUX_KERNEL_INTREE_DTS_NAME="exynos5422-odroidxu4"
+BR2_PACKAGE_ODROID_XU_BL=y
+BR2_TARGET_UBOOT=y
+BR2_TARGET_UBOOT_BOARDNAME="odroid-xu3"
Signature · 1 line
2.8.1
#7 lore raw

PATCH 2/2 board: add support for the Odroid XU4 board

Hi Andi,

Quoted 1 line · Andi Shyti

The Odroid XU4 board is released by hardkernel and has a Samsunx

Samsung.

Quoted 1 line

5422 SoC.

[snip]

Quoted 4 lines
board/odroid-xu4/readme.txt new file +4 -0
+At the end of the build you should get in the output/images directory the
+following files:
+
+ - bl1.bin.hardkernel

board/odroid-xu4/readme.txt line 70

Quoted 10 lines
board/odroid-xu4/readme.txt new file +10 -0
+	Level 1 boot loader
+
+ - bl2.bin.hardkernel.1mb_uboot
+	Level 2 boot loader
+
+ - exynos5422-odroidxu4.dtb
+	Linux Kernel Device Tree blop
+
+ - rootfs.tar
+	Compressed root file system image

Not compressed.

baruch

Signature · 3 lines
     http://baruch.siach.name/blog/                  ~. .~   Tk Open Systems
=}------------------------------------------------ooO--U--Ooo------------{=
   - baruch at tkos.co.il - tel: +972.52.368.4656, http://www.tkos.co.il -
author
#8 lore raw

PATCH 2/2 board: add support for the Odroid XU4 board

Quoted 19 lines · Andi Shyti
Quoted 2 lines

The Odroid XU4 board is released by hardkernel and has a Samsunx

Samsung.

Quoted 1 line

5422 SoC.

[snip]

Quoted 9 lines

+At the end of the build you should get in the output/images directory the

board/odroid-xu4/readme.txt new file +7 -0
+following files:
+
+ - bl1.bin.hardkernel
+   Level 1 boot loader
+
+ - bl2.bin.hardkernel.1mb_uboot
+   Level 2 boot loader
Quoted 8 lines

board/odroid-xu4/readme.txt line 70

Quoted 6 lines
board/odroid-xu4/readme.txt new file +6 -0
+
+ - exynos5422-odroidxu4.dtb
+   Linux Kernel Device Tree blop
+
+ - rootfs.tar
+   Compressed root file system image

Not compressed.

Thanks Baruch, I will fix them.

Andi

#9 lore raw

PATCH 2/2 board: add support for the Odroid XU4 board

In reply to Andi Shyti

Hello,

Quoted 57 lines · Andi Shyti
board/odroid-xu4/readme.txt new file +57 -0
+Set up the bootloader
+---------------------
+
+I will assume you will use an sd card which will have as mount point /dev/sdb.
+The above images need to be flashed to the SD card to specific addresses, as
+follows:
+
+ # dd if=bl1.bin.hardkernel of=/dev/sdb seek=1 bs=512
+ # dd if=bl2.bin.hardkernel.1mb_uboot of=/dev/sdb seek=31 bs=512
+ # dd if=u-boot.bin of=/dev/sdb seek=63 bs=512
+ # dd if=tzsw.bin.hardkernel of=/dev/sdb seek=2111 bs=512
+
+With the above we should be able to boot up to the u-boot bootloader.
+
+Set up the SD card
+------------------
+
+The SD card will need to partitions, which you can make with your favourite
+partitioner. At the end it should look like this:
+
+Device         Boot  Start      End  Sectors  Size Id Type
+/dev/sdb1             4096   135167   131072   64M  b W95 FAT32
+/dev/sdb2           135168 15523839 15388672  7.3G 83 Linux
+
+IMPORTANT: Please note that the first partition starts at the block 4096 instead
+of the default 2048. This is due to the sizes of the binaries we flased earlier,
+which go over the 2048 block, therefore, you need to start the first partition
+at a further location, e.g. 4096.
+
+Now format the two partitions, the first as vfat FS type, the second as EXT3 or
+EXT4:
+
+ # mkfs.vfat /dev/sdb1
+ # mkfs.ext4 /dev/sdb2
+
+Finalize the SD card
+--------------------
+
+Now it's time to move Kernel and File System to the SD card. We will start from
+the Kernel partition.
+
+First mount it:
+
+ # mount /dev/sdb1/ /mnt/
+
+and copy kernel and dtb
+
+ # cp <buildroot>/output/images/zImage /mnt/
+ # cp <buildroot>/output/images/exynos5422-odroidxu4.dtb /mnt/
+
+umount the partition
+
+ # sync
+ # umount /dev/sdb1
+
+Mount the rootfs partition:
+

board/odroid-xu4/readme.txt line 147

Quoted 10 lines
board/odroid-xu4/readme.txt new file +10 -0
+ # mount /dev/sdb2 /mnt/
+ # tar
+ # cp <buildroot>/output/images/rootfs.tar -C /mnt/
+
+Umount the partition
+
+ # sync
+ # umount /dev/sdb2
+
+The SD card is ready, you can boot now your Odroid XU-4.

Please replace all this with a genimage script. It allows you to easily describe a FAT and an ext4 partition, and also allows you to place your bootloader images at arbitrary offsets.

See board/freescale/imx6ulevk/genimage.cfg for an example.

board/odroid-xu4/readme.txt line 157

Quoted 9 lines
board/odroid-xu4/readme.txt new file +9 -0
+Automate u-boot commands
+------------------------
+
+In order to avoid customizing u-boot from the u-boot system at boot time, you
+can use the boot.cmd file in board/odroid-xu4.
+
+Jut run
+
+ $ mkimage -A arm -T script -C none -d boot.cmd boot.scr

Please do this in a post-image script, do that boot.scr is directly produced in output/images, and added to the FAT partition by the genimage script.

See board/orangepi/orangepipc/post-build.sh for an example.

configs/odroid-xu4_defconfig line 3

Quoted 9 lines
configs/odroid-xu4_defconfig new file +3 -0
new file mode 100644
index 0000000..5eca993
@@ -0,0 +1,10 @@
+BR2_arm=y
+BR2_cortex_a7=y
+BR2_KERNEL_HEADERS_4_6=y

Please use:

BR2_PACKAGE_HOST_LINUX_HEADERS_CUSTOM_4_6=y

which tells Buildroot to use the sources of the kernel being built for the kernel headers.

configs/odroid-xu4_defconfig line 4

Quoted 1 line
configs/odroid-xu4_defconfig new file +1 -0
+BR2_LINUX_KERNEL=y

You need to specify the exact kernel version that you want to build.

configs/odroid-xu4_defconfig line 9

Quoted 5 lines
configs/odroid-xu4_defconfig new file +5 -0
+BR2_LINUX_KERNEL_DEFCONFIG="exynos"
+BR2_LINUX_KERNEL_DTS_SUPPORT=y
+BR2_LINUX_KERNEL_INTREE_DTS_NAME="exynos5422-odroidxu4"
+BR2_PACKAGE_ODROID_XU_BL=y
+BR2_TARGET_UBOOT=y

You need to specify the exact U-Boot version that you want to build. So, as per my reply on PATCH 1/2, it should probably point to the vendor-specific U-Boot version, so that you can use the pre-built binaries for the first stage bootloaders.

configs/odroid-xu4_defconfig line 10

Quoted 1 line
configs/odroid-xu4_defconfig new file +1 -0
+BR2_TARGET_UBOOT_BOARDNAME="odroid-xu3"

Thanks,

Thomas

Signature · 3 lines
Thomas Petazzoni, CTO, Free Electrons
Embedded Linux, Kernel and Android engineering
http://free-electrons.com
author
#10 lore raw

PATCH 2/2 board: add support for the Odroid XU4 board

Hi Thomas,

Quoted 37 lines
Quoted 22 lines
board/odroid-xu4/readme.txt new file +22 -0
+Finalize the SD card
+--------------------
+
+Now it's time to move Kernel and File System to the SD card. We will start from
+the Kernel partition.
+
+First mount it:
+
+ # mount /dev/sdb1/ /mnt/
+
+and copy kernel and dtb
+
+ # cp <buildroot>/output/images/zImage /mnt/
+ # cp <buildroot>/output/images/exynos5422-odroidxu4.dtb /mnt/
+
+umount the partition
+
+ # sync
+ # umount /dev/sdb1
+
+Mount the rootfs partition:
+

board/odroid-xu4/readme.txt line 147

Quoted 10 lines
board/odroid-xu4/readme.txt new file +10 -0
+ # mount /dev/sdb2 /mnt/
+ # tar
+ # cp <buildroot>/output/images/rootfs.tar -C /mnt/
+
+Umount the partition
+
+ # sync
+ # umount /dev/sdb2
+
+The SD card is ready, you can boot now your Odroid XU-4.

Please replace all this with a genimage script. It allows you to easily describe a FAT and an ext4 partition, and also allows you to place your bootloader images at arbitrary offsets.

Quoted 1 line

See board/freescale/imx6ulevk/genimage.cfg for an example.

sure! It's indeed better!

Quoted 14 lines

board/odroid-xu4/readme.txt line 157

Quoted 9 lines
board/odroid-xu4/readme.txt new file +9 -0
+Automate u-boot commands
+------------------------
+
+In order to avoid customizing u-boot from the u-boot system at boot time, you
+can use the boot.cmd file in board/odroid-xu4.
+
+Jut run
+
+ $ mkimage -A arm -T script -C none -d boot.cmd boot.scr

Please do this in a post-image script, do that boot.scr is directly produced in output/images, and added to the FAT partition by the genimage script.

Quoted 1 line

See board/orangepi/orangepipc/post-build.sh for an example.

I will, thanks!

Quoted 10 lines

configs/odroid-xu4_defconfig line 3

Quoted 3 lines
configs/odroid-xu4_defconfig new file +3 -0
+BR2_arm=y
+BR2_cortex_a7=y
+BR2_KERNEL_HEADERS_4_6=y

Please use:

BR2_PACKAGE_HOST_LINUX_HEADERS_CUSTOM_4_6=y

which tells Buildroot to use the sources of the kernel being built for the kernel headers.

OK.

Quoted 3 lines
Quoted 1 line

+BR2_LINUX_KERNEL=y

You need to specify the exact kernel version that you want to build.

OK.

Quoted 10 lines

configs/odroid-xu4_defconfig line 9

Quoted 5 lines
configs/odroid-xu4_defconfig new file +5 -0
+BR2_LINUX_KERNEL_DEFCONFIG="exynos"
+BR2_LINUX_KERNEL_DTS_SUPPORT=y
+BR2_LINUX_KERNEL_INTREE_DTS_NAME="exynos5422-odroidxu4"
+BR2_PACKAGE_ODROID_XU_BL=y
+BR2_TARGET_UBOOT=y

You need to specify the exact U-Boot version that you want to build. So, as per my reply on PATCH 1/2, it should probably point to the vendor-specific U-Boot version, so that you can use the pre-built binaries for the first stage bootloaders.

OK.

Quoted 3 lines
Quoted 1 line

+BR2_TARGET_UBOOT_BOARDNAME="odroid-xu3"

Thanks,

Thank you, I will fix the above in the second version of the patchset.

Andi

#11 lore raw

cover Odroid XU4 support

In reply to Andi Shyti

Hello Andi!

Quoted 6 lines · Andi Shyti

this patchset adds support for the Odroid XU4 board.

The first patch adds the first two stages of boot firmare and the trust zone, necessary to boot the device.

While the second patch adds the actual support of the board.

Thanks for this contribution, it's very useful to have support for such platforms. I have some comments though, so I'll reply to the individual patches.

Thanks,

Thomas

Signature · 3 lines
Thomas Petazzoni, CTO, Free Electrons
Embedded Linux, Kernel and Android engineering
http://free-electrons.com