Skip to contentSkip to conversation

Add support for Libre Computer AML-S905X-CC board

PATCH New Neil Armstrong 2 participants 8 messages Aug 6, 2018 – Sep 20, 2018

lore
Share & tools
lore
#0 lore raw

cover Add support for Libre Computer AML-S905X-CC board

This patch adds support for the Libre Computer AML-S905X-CC based on an Amlogic S905X SoC.

The board features :
- 4xCortex-A53 Cores
- 1 or 2Gib or DDR4
- RS232 TTL Header
- MicroUSB for Power Only
- HDMI 2.0b output + CEC
- CVBS + Audio Jack
- 10/100 Ethernet
- 4xUSB2.0
- IR Receiver
- SDCard
- eMMC optional slot
- 40pin connector partially RPi compatible
- 8Pin I2S 7.1 connector
- 3Pin SPDIF connector

The board is entirely supported since U-boot 2018.01 and Linux 4.14.

In order the generate a valid bootable SDCard image, the "aml-s905x-cc-fip" is also part of this patchset.

Neil Armstrong (2):
boot: aml-s905x-cc-fip: new package for Libre Computer AML-S905X-CC
boot firmwares
board: Add Libre Computer AML-S905X-CC board support

 DEVELOPERS                                     |  5 ++
 board/librecomputer/aml-s905x-cc/extlinux.conf |  6 +++
 board/librecomputer/aml-s905x-cc/genimage.cfg  | 11 +++++
 board/librecomputer/aml-s905x-cc/post-build.sh |  5 ++
 board/librecomputer/aml-s905x-cc/post-image.sh | 64 ++++++++++++++++++++++++++
 board/librecomputer/aml-s905x-cc/readme.txt    | 50 ++++++++++++++++++++
 boot/Config.in                                 |  1 +
 boot/aml-s905x-cc-fip/Config.in                |  5 ++
 boot/aml-s905x-cc-fip/aml-s905x-cc-fip.hash    |  2 +
 boot/aml-s905x-cc-fip/aml-s905x-cc-fip.mk      | 26 +++++++++++
 configs/aml-s905x-cc_defconfig                 | 30 ++++++++++++
 11 files changed, 205 insertions(+)
 create mode 100644 board/librecomputer/aml-s905x-cc/extlinux.conf
 create mode 100644 board/librecomputer/aml-s905x-cc/genimage.cfg
 create mode 100755 board/librecomputer/aml-s905x-cc/post-build.sh
 create mode 100755 board/librecomputer/aml-s905x-cc/post-image.sh
 create mode 100644 board/librecomputer/aml-s905x-cc/readme.txt
 create mode 100644 boot/aml-s905x-cc-fip/Config.in
 create mode 100644 boot/aml-s905x-cc-fip/aml-s905x-cc-fip.hash
 create mode 100644 boot/aml-s905x-cc-fip/aml-s905x-cc-fip.mk
 create mode 100644 configs/aml-s905x-cc_defconfig
Signature · 1 line
2.7.4
#1 lore raw

PATCH 1/2 boot: aml-s905x-cc-fip: new package for Libre Computer AML-S905X-CC boot firmwares

The Libre Computer AML-S905X-CC is based on am Amlogic S905X SoCs and needs some pre-build ATF firmwares named "FIP" in order to generate a valid boot binary.

These files are used in the post-image board script to generate a bootable sdcard.img file.

---
 DEVELOPERS                                  |  3 +++
 boot/Config.in                              |  1 +
 boot/aml-s905x-cc-fip/Config.in             |  5 +++++
 boot/aml-s905x-cc-fip/aml-s905x-cc-fip.hash |  2 ++
 boot/aml-s905x-cc-fip/aml-s905x-cc-fip.mk   | 26 ++++++++++++++++++++++++++
 5 files changed, 37 insertions(+)
 create mode 100644 boot/aml-s905x-cc-fip/Config.in
 create mode 100644 boot/aml-s905x-cc-fip/aml-s905x-cc-fip.hash
 create mode 100644 boot/aml-s905x-cc-fip/aml-s905x-cc-fip.mk
DEVELOPERS +3 -0
index 215506c..66d2c51 100644
@@ -1458,6 +1458,9 @@ N:	Naumann Andreas <[email protected]>
 F:	package/evemu/
 F:	package/libevdev/
 
+N:	Neil Armstrong <[email protected]>
+F:	boot/aml-s905x-cc-fip/
+
 N:	Nicolas Cavallari <[email protected]>
 F:	package/libgit2/
 
boot/Config.in +1 -0
index 3687c41..a0d897f 100644
@@ -4,6 +4,7 @@ source "boot/afboot-stm32/Config.in"
 source "boot/at91bootstrap/Config.in"
 source "boot/at91bootstrap3/Config.in"
 source "boot/at91dataflashboot/Config.in"
+source "boot/aml-s905x-cc-fip/Config.in"
 source "boot/arm-trusted-firmware/Config.in"
 source "boot/barebox/Config.in"
 source "boot/binaries-marvell/Config.in"
boot/aml-s905x-cc-fip/Config.in new file +5 -0
new file mode 100644
index 0000000..1cd0b99
@@ -0,0 +1,5 @@
+config BR2_TARGET_AML_S905X_CC_FIP
+	bool "aml-s905x-cc fip"
+	depends on BR2_aarch64
+	help
+	  Amlogic FIP boot firmwares for AML-S905X-CC
boot/aml-s905x-cc-fip/aml-s905x-cc-fip.hash new file +2 -0
new file mode 100644
index 0000000..aad3fc1
@@ -0,0 +1,2 @@
+# Locally calculated
+sha256 957c96037bcd792a4139cc33eded2f006d55a82c0c56ae69ef43bdcb76a255e2 libretech-cc_fip_20170606.tar.gz
boot/aml-s905x-cc-fip/aml-s905x-cc-fip.mk new file +26 -0
new file mode 100644
index 0000000..7aa6af9
@@ -0,0 +1,26 @@
+################################################################################
+#
+# aml-s905x-cc-fip
+#
+################################################################################
+
+AML_S905X_CC_FIP_VERSION = 20170606
+AML_S905X_CC_FIP_SOURCE = libretech-cc_fip_$(AML_S905X_CC_FIP_VERSION).tar.gz
+AML_S905X_CC_FIP_SITE = https://github.com/BayLibre/u-boot/releases/download/v2017.11-libretech-cc
+AML_S905X_CC_FIP_LICENSE = Amlogic
+
+AML_S905X_CC_FIP_INSTALL_IMAGES = YES
+
+define AML_S905X_CC_FIP_INSTALL_IMAGES_CMDS
+	$(INSTALL) -D -m 0644 $(@D)/gxl/bl2.bin $(BINARIES_DIR)/fip/bl2.bin
+	$(INSTALL) -D -m 0644 $(@D)/gxl/acs.bin $(BINARIES_DIR)/fip/acs.bin
+	$(INSTALL) -D -m 0644 $(@D)/gxl/bl21.bin $(BINARIES_DIR)/fip/bl21.bin
+	$(INSTALL) -D -m 0644 $(@D)/gxl/bl30.bin $(BINARIES_DIR)/fip/bl30.bin
+	$(INSTALL) -D -m 0644 $(@D)/gxl/bl301.bin $(BINARIES_DIR)/fip/bl301.bin
+	$(INSTALL) -D -m 0644 $(@D)/gxl/bl31.img $(BINARIES_DIR)/fip/bl31.img
+	$(INSTALL) -D -m 0755 $(@D)/gxl/aml_encrypt_gxl $(BINARIES_DIR)/fip/aml_encrypt_gxl
+	$(INSTALL) -D -m 0755 $(@D)/blx_fix.sh $(BINARIES_DIR)/fip/blx_fix.sh
+	$(INSTALL) -D -m 0644 $(@D)/acs_tool.pyc $(BINARIES_DIR)/fip/acs_tool.pyc
+endef
+
+$(eval $(generic-package))
Signature · 1 line
2.7.4
#2 lore raw

PATCH 1/2 boot: aml-s905x-cc-fip: new package for Libre Computer AML-S905X-CC boot firmwares

Hello,

Thanks for this new proposal. However, I still have some concerns about it :-/

boot/Config.in source "boot/afboot-stm32/Config.in" · line 7

Quoted 9 lines · Neil Armstrong
boot/Config.in +1 -0
index 3687c41..a0d897f 100644
@@ -4,6 +4,7 @@ source "boot/afboot-stm32/Config.in"
 source "boot/at91bootstrap/Config.in"
 source "boot/at91bootstrap3/Config.in"
 source "boot/at91dataflashboot/Config.in"
+source "boot/aml-s905x-cc-fip/Config.in"

Alphabetic ordering is not good.

boot/Config.in source "boot/afboot-stm32/Config.in" · line 8

Quoted 1 line
boot/Config.in +1 -0
+	  Amlogic FIP boot firmwares for AML-S905X-CC

Is this package specific to a board ? to a SoC ?

Quoted 6 lines
boot/aml-s905x-cc-fip/aml-s905x-cc-fip.mk new file +0 -0
new file mode 100644
index 0000000..7aa6af9

boot/aml-s905x-cc-fip/aml-s905x-cc-fip.mk line 10

Quoted 10 lines
boot/aml-s905x-cc-fip/aml-s905x-cc-fip.mk new file +10 -0
@@ -0,0 +1,26 @@
+################################################################################
+#
+# aml-s905x-cc-fip
+#
+################################################################################
+
+AML_S905X_CC_FIP_VERSION = 20170606
+AML_S905X_CC_FIP_SOURCE = libretech-cc_fip_$(AML_S905X_CC_FIP_VERSION).tar.gz
+AML_S905X_CC_FIP_SITE = https://github.com/BayLibre/u-boot/releases/download/v2017.11-libretech-cc
+AML_S905X_CC_FIP_LICENSE = Amlogic

"Amlogic" is not a license. We need a proper license, that at least gives the right to redistribute those binaries. Without a license, nobody is allowed to redistribute those binaries, making them pretty useless.

boot/aml-s905x-cc-fip/aml-s905x-cc-fip.mk line 23

Quoted 10 lines
boot/aml-s905x-cc-fip/aml-s905x-cc-fip.mk new file +10 -0
+define AML_S905X_CC_FIP_INSTALL_IMAGES_CMDS
+	$(INSTALL) -D -m 0644 $(@D)/gxl/bl2.bin $(BINARIES_DIR)/fip/bl2.bin
+	$(INSTALL) -D -m 0644 $(@D)/gxl/acs.bin $(BINARIES_DIR)/fip/acs.bin
+	$(INSTALL) -D -m 0644 $(@D)/gxl/bl21.bin $(BINARIES_DIR)/fip/bl21.bin
+	$(INSTALL) -D -m 0644 $(@D)/gxl/bl30.bin $(BINARIES_DIR)/fip/bl30.bin
+	$(INSTALL) -D -m 0644 $(@D)/gxl/bl301.bin $(BINARIES_DIR)/fip/bl301.bin
+	$(INSTALL) -D -m 0644 $(@D)/gxl/bl31.img $(BINARIES_DIR)/fip/bl31.img
+	$(INSTALL) -D -m 0755 $(@D)/gxl/aml_encrypt_gxl $(BINARIES_DIR)/fip/aml_encrypt_gxl
+	$(INSTALL) -D -m 0755 $(@D)/blx_fix.sh $(BINARIES_DIR)/fip/blx_fix.sh
+	$(INSTALL) -D -m 0644 $(@D)/acs_tool.pyc $(BINARIES_DIR)/fip/acs_tool.pyc

These last three files are host programs, they should be installed to $(HOST_DIR).

However:

- aml_encrypt_gxl is a prebuilt binary for x86-64. This means this package should depend on host arch being x86-64:

depends on BR2_HOSTARCH = "x86_64"

You really don't have the source code for this tool ? It would be much easier.

- acs_tool.pyc is byte-compiled. You also don't have the source code here ? I'm not sure how much Python bytecode is compatible between Python versions. The bytecode you have has been built with Python 2.7. Does it work with Python 2.6 ? Python 3.x ?

Also, perhaps we should do like arm-trusted-firmware: make this package depend on u-boot, and then include all the complicated firmware generation logic inside aml-s905x-cc instead of having it in a post-image script.

Best regards,

Thomas

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

PATCH 1/2 boot: aml-s905x-cc-fip: new package for Libre Computer AML-S905X-CC boot firmwares

Hi,

Quoted 4 lines · Thomas Petazzoni

Hello,

Thanks for this new proposal. However, I still have some concerns about it :-/

Thanks, sorry for the delayed answer....

Quoted 14 lines · Neil Armstrong

boot/Config.in source "boot/afboot-stm32/Config.in" · line 7

Quoted 10 lines
boot/Config.in +1 -0
index 3687c41..a0d897f 100644
@@ -4,6 +4,7 @@ source "boot/afboot-stm32/Config.in"
 source "boot/at91bootstrap/Config.in"
 source "boot/at91bootstrap3/Config.in"
 source "boot/at91dataflashboot/Config.in"
+source "boot/aml-s905x-cc-fip/Config.in"

Alphabetic ordering is not good.

Ok

Quoted 4 lines

boot/Config.in source "boot/afboot-stm32/Config.in" · line 8

Quoted 2 lines
boot/Config.in +1 -0
+	  Amlogic FIP boot firmwares for AML-S905X-CC

Is this package specific to a board ? to a SoC ?

To a board, it contains code loaded in SCP co-processor to handle the CPU power rails.

Quoted 14 lines
Quoted 14 lines
boot/aml-s905x-cc-fip/aml-s905x-cc-fip.mk new file +7 -0
new file mode 100644
index 0000000..7aa6af9
@@ -0,0 +1,26 @@
+################################################################################
+#
+# aml-s905x-cc-fip
+#
+################################################################################
+
+AML_S905X_CC_FIP_VERSION = 20170606
Quoted 8 lines

boot/aml-s905x-cc-fip/aml-s905x-cc-fip.mk line 10

Quoted 3 lines
boot/aml-s905x-cc-fip/aml-s905x-cc-fip.mk new file +3 -0
+AML_S905X_CC_FIP_SOURCE = libretech-cc_fip_$(AML_S905X_CC_FIP_VERSION).tar.gz
+AML_S905X_CC_FIP_SITE = https://github.com/BayLibre/u-boot/releases/download/v2017.11-libretech-cc
+AML_S905X_CC_FIP_LICENSE = Amlogic

"Amlogic" is not a license. We need a proper license, that at least gives the right to redistribute those binaries. Without a license, nobody is allowed to redistribute those binaries, making them pretty useless.

Yes, it's an issue we need to handle, we are in the process to discuss an EULA for that.

Quoted 17 lines

boot/aml-s905x-cc-fip/aml-s905x-cc-fip.mk line 23

Quoted 11 lines
boot/aml-s905x-cc-fip/aml-s905x-cc-fip.mk new file +10 -0
+define AML_S905X_CC_FIP_INSTALL_IMAGES_CMDS
+	$(INSTALL) -D -m 0644 $(@D)/gxl/bl2.bin $(BINARIES_DIR)/fip/bl2.bin
+	$(INSTALL) -D -m 0644 $(@D)/gxl/acs.bin $(BINARIES_DIR)/fip/acs.bin
+	$(INSTALL) -D -m 0644 $(@D)/gxl/bl21.bin $(BINARIES_DIR)/fip/bl21.bin
+	$(INSTALL) -D -m 0644 $(@D)/gxl/bl30.bin $(BINARIES_DIR)/fip/bl30.bin
+	$(INSTALL) -D -m 0644 $(@D)/gxl/bl301.bin $(BINARIES_DIR)/fip/bl301.bin
+	$(INSTALL) -D -m 0644 $(@D)/gxl/bl31.img $(BINARIES_DIR)/fip/bl31.img
+	$(INSTALL) -D -m 0755 $(@D)/gxl/aml_encrypt_gxl $(BINARIES_DIR)/fip/aml_encrypt_gxl
+	$(INSTALL) -D -m 0755 $(@D)/blx_fix.sh $(BINARIES_DIR)/fip/blx_fix.sh
+	$(INSTALL) -D -m 0644 $(@D)/acs_tool.pyc $(BINARIES_DIR)/fip/acs_tool.pyc

These last three files are host programs, they should be installed to $(HOST_DIR).

However:

Quoted 7 lines

- aml_encrypt_gxl is a prebuilt binary for x86-64. This means this package should depend on host arch being x86-64:

depends on BR2_HOSTARCH = "x86_64"

You really don't have the source code for this tool ? It would be much easier.

I would loved to...

Quoted 5 lines

- acs_tool.pyc is byte-compiled. You also don't have the source code here ? I'm not sure how much Python bytecode is compatible between Python versions. The bytecode you have has been built with Python 2.7. Does it work with Python 2.6 ? Python 3.x ?

I would also loved to have the source of this.

Quoted 5 lines

Also, perhaps we should do like arm-trusted-firmware: make this package depend on u-boot, and then include all the complicated firmware generation logic inside aml-s905x-cc instead of having it in a post-image script.

Makes sense.

Quoted 5 lines

Best regards,

Thomas

Thanks for the review,

Until we have a clear EULA I will drop U-boot support.

Neil

#4 lore raw

PATCH 2/2 board: Add Libre Computer AML-S905X-CC board support

In reply to Neil Armstrong

This patch adds support for the Libre Computer AML-S905X-CC based on an Amlogic S905X SoCs.

The board features :
- 4xCortex-A53 Cores
- 1 or 2Gib or DDR4
- RS232 TTL Header
- MicroUSB for Power Only
- HDMI 2.0b output + CEC
- CVBS + Audio Jack
- 10/100 Ethernet
- 4xUSB2.0
- IR Receiver
- SDCard
- eMMC optional slot
- 40pin connector partially RPi compatible
- 8Pin I2S 7.1 connector
- 3Pin SPDIF connector

The board is entirely supported since U-boot 2018.01 and Linux 4.14.

The Buildroot support is done with upstream only package and the previously submitted "aml-s905x-cc-fip" package to generate a valid bootable SDCard image.

---
 DEVELOPERS                                     |  2 +
 board/librecomputer/aml-s905x-cc/extlinux.conf |  6 +++
 board/librecomputer/aml-s905x-cc/genimage.cfg  | 11 +++++
 board/librecomputer/aml-s905x-cc/post-build.sh |  5 ++
 board/librecomputer/aml-s905x-cc/post-image.sh | 64 ++++++++++++++++++++++++++
 board/librecomputer/aml-s905x-cc/readme.txt    | 50 ++++++++++++++++++++
 configs/aml-s905x-cc_defconfig                 | 30 ++++++++++++
 7 files changed, 168 insertions(+)
 create mode 100644 board/librecomputer/aml-s905x-cc/extlinux.conf
 create mode 100644 board/librecomputer/aml-s905x-cc/genimage.cfg
 create mode 100755 board/librecomputer/aml-s905x-cc/post-build.sh
 create mode 100755 board/librecomputer/aml-s905x-cc/post-image.sh
 create mode 100644 board/librecomputer/aml-s905x-cc/readme.txt
 create mode 100644 configs/aml-s905x-cc_defconfig
DEVELOPERS +2 -0
index 66d2c51..6f18f93 100644
@@ -1460,6 +1460,8 @@ F:	package/libevdev/
 
 N:	Neil Armstrong <[email protected]>
 F:	boot/aml-s905x-cc-fip/
+F:	board/librecomputer/aml-s905x-cc
+F:	configs/aml-s905x-cc_defconfig
 
 N:	Nicolas Cavallari <[email protected]>
 F:	package/libgit2/
board/librecomputer/aml-s905x-cc/extlinux.conf new file +6 -0
new file mode 100644
index 0000000..aa58a2c
@@ -0,0 +1,6 @@
+default buildroot
+
+label buildroot
+kernel /boot/Image
+devicetree /boot/meson-gxl-s905x-libretech-cc.dtb
+append console=ttyAML0,115200 root=/dev/mmcblk1p1 rootwait rw
board/librecomputer/aml-s905x-cc/genimage.cfg new file +11 -0
new file mode 100644
index 0000000..f559e35
@@ -0,0 +1,11 @@
+image sdcard.img {
+	hdimage {
+	}
+
+	partition rootfs {
+		partition-type = 0x83
+		image = "rootfs.ext4"
+		size = 512M
+		offset = 1048576
+	}
+}
board/librecomputer/aml-s905x-cc/post-build.sh new file +5 -0
new file mode 100755
index 0000000..1f5ff6a
@@ -0,0 +1,5 @@
+#!/bin/sh
+
+BOARD_DIR="$(dirname $0)"
+
+install -m 0644 -D $BOARD_DIR/extlinux.conf $TARGET_DIR/boot/extlinux/extlinux.conf
board/librecomputer/aml-s905x-cc/post-image.sh new file +64 -0

64 lines not on this page · raw message

board/librecomputer/aml-s905x-cc/readme.txt new file +50 -0

50 lines not on this page · raw message

configs/aml-s905x-cc_defconfig new file +30 -0
new file mode 100644
index 0000000..cb2550b
@@ -0,0 +1,30 @@
+# Architecture
+BR2_aarch64=y
+
+# System
+BR2_TARGET_GENERIC_HOSTNAME="aml-s905x-cc"
+BR2_TARGET_ROOTFS_EXT2=y
+BR2_TARGET_ROOTFS_EXT2_4=y
+BR2_ROOTFS_POST_BUILD_SCRIPT="board/librecomputer/aml-s905x-cc/post-build.sh"
+BR2_ROOTFS_POST_IMAGE_SCRIPT="board/librecomputer/aml-s905x-cc/post-image.sh"
+
+# Kernel
+BR2_LINUX_KERNEL=y
+BR2_LINUX_KERNEL_USE_ARCH_DEFAULT_CONFIG=y
+BR2_LINUX_KERNEL_DTS_SUPPORT=y
+BR2_LINUX_KERNEL_BUILD_DEFAULT_DTS=y
+BR2_LINUX_KERNEL_USE_INTREE_DTS=y
+BR2_LINUX_KERNEL_INTREE_DTS_NAME="amlogic/meson-gxl-s905x-libretech-cc"
+BR2_LINUX_KERNEL_IMAGE=y
+BR2_LINUX_KERNEL_INSTALL_TARGET=y
+
+# U-Boot
+BR2_TARGET_UBOOT=y
+BR2_TARGET_UBOOT_BOARDNAME="libretech-cc"
+BR2_TARGET_UBOOT_BOARD_DEFCONFIG="libretech-cc"
+BR2_TARGET_AML_S905X_CC_FIP=y
+
+# Required tools to create the SD image
+BR2_PACKAGE_HOST_DOSFSTOOLS=y
+BR2_PACKAGE_HOST_GENIMAGE=y
+BR2_PACKAGE_HOST_MTOOLS=y
Signature · 1 line
2.7.4
#5 lore raw

PATCH 2/2 board: Add Libre Computer AML-S905X-CC board support

Hello Neil,

Quoted 31 lines · Neil Armstrong
board/librecomputer/aml-s905x-cc/post-image.sh new file +31 -0
+mkdir ${BINARIES_DIR}/fip/tmp
+cp ${BINARIES_DIR}/u-boot.bin ${BINARIES_DIR}/fip/tmp/bl33.bin
+cp ${BINARIES_DIR}/fip/bl31.img ${BINARIES_DIR}/fip/tmp/bl31.img
+
+${BINARIES_DIR}/fip/blx_fix.sh ${BINARIES_DIR}/fip/bl30.bin \
+		${BINARIES_DIR}/fip/tmp/zero_tmp \
+		${BINARIES_DIR}/fip/tmp/bl30_zero.bin \
+		${BINARIES_DIR}/fip/bl301.bin \
+		${BINARIES_DIR}/fip/tmp/bl301_zero.bin \
+		${BINARIES_DIR}/fip/tmp/bl30_new.bin bl30
+
+python ${BINARIES_DIR}/fip/acs_tool.pyc ${BINARIES_DIR}/fip/bl2.bin \
+		${BINARIES_DIR}/fip/tmp/bl2_acs.bin \
+		${BINARIES_DIR}/fip/acs.bin 0
+
+${BINARIES_DIR}/fip/blx_fix.sh ${BINARIES_DIR}/fip/tmp/bl2_acs.bin \
+		${BINARIES_DIR}/fip/tmp/zero_tmp \
+		${BINARIES_DIR}/fip/tmp/bl2_zero.bin \
+		${BINARIES_DIR}/fip/bl21.bin \
+		${BINARIES_DIR}/fip/tmp/bl21_zero.bin \
+		${BINARIES_DIR}/fip/tmp/bl2_new.bin bl2
+
+${BINARIES_DIR}/fip/aml_encrypt_gxl --bl3enc \
+		--input ${BINARIES_DIR}/fip/tmp/bl30_new.bin
+
+${BINARIES_DIR}/fip/aml_encrypt_gxl --bl3enc \
+		--input ${BINARIES_DIR}/fip/tmp/bl31.img
+
+${BINARIES_DIR}/fip/aml_encrypt_gxl --bl3enc \
+		--input ${BINARIES_DIR}/fip/tmp/bl33.bin
+

board/librecomputer/aml-s905x-cc/post-image.sh line 56

Quoted 10 lines
board/librecomputer/aml-s905x-cc/post-image.sh new file +10 -0
+${BINARIES_DIR}/fip/aml_encrypt_gxl --bl2sig \
+		--input ${BINARIES_DIR}/fip/tmp/bl2_new.bin \
+		--output ${BINARIES_DIR}/fip/tmp/bl2.n.bin.sig
+
+${BINARIES_DIR}/fip/aml_encrypt_gxl --bootmk \
+		--output ${BINARIES_DIR}/fip/tmp/u-boot.bin \
+		--bl2 ${BINARIES_DIR}/fip/tmp/bl2.n.bin.sig \
+		--bl30 ${BINARIES_DIR}/fip/tmp/bl30_new.bin.enc \
+		--bl31 ${BINARIES_DIR}/fip/tmp/bl31.img.enc \
+		--bl33 ${BINARIES_DIR}/fip/tmp/bl33.bin.enc

Can't all this stuff be done in a script provided in the aml-s905x-cc repository ?

board/librecomputer/aml-s905x-cc/post-image.sh line 64

Quoted 7 lines
board/librecomputer/aml-s905x-cc/post-image.sh new file +7 -0
+dd if=${BINARIES_DIR}/fip/tmp/u-boot.bin.sd.bin \
+   of=${BINARIES_DIR}/sdcard.img \
+   bs=1 count=444 conv=sync,notrunc
+
+dd if=${BINARIES_DIR}/fip/tmp/u-boot.bin.sd.bin \
+   of=${BINARIES_DIR}/sdcard.img \
+   bs=512 skip=1 seek=1 conv=fsync,notrunc

Both of these should be done using the genimage configuration file. genimage allows you to place some image data at an arbitrary offset:

For example:

        partition spl {
                in-partition-table = "no"
                image = "sunxi-spl.bin"
                offset = 8192
        }

        partition u-boot {
                in-partition-table = "no"
                image = "u-boot.itb"
                offset = 40K
                size = 1M # 1MB - 40K
        }

board/librecomputer/aml-s905x-cc/readme.txt line 45

Quoted 7 lines
board/librecomputer/aml-s905x-cc/readme.txt new file +7 -0
+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":

How is the eMMC visible as a block device on the build machine ?

configs/aml-s905x-cc_defconfig line 2

Quoted 8 lines
configs/aml-s905x-cc_defconfig new file +2 -0
new file mode 100644
index 0000000..cb2550b
@@ -0,0 +1,30 @@
+# Architecture
+BR2_aarch64=y

You need something like this:

# Linux headers same as kernel, a 4.14 series
BR2_PACKAGE_HOST_LINUX_HEADERS_CUSTOM_4_14=y

to make sure the toolchain uses the same kernel headers version as the kernel being built.

configs/aml-s905x-cc_defconfig line 5

Quoted 2 lines
configs/aml-s905x-cc_defconfig new file +2 -0
+# System
+BR2_TARGET_GENERIC_HOSTNAME="aml-s905x-cc"

Probably not needed.

configs/aml-s905x-cc_defconfig line 12

Quoted 7 lines
configs/aml-s905x-cc_defconfig new file +7 -0
+BR2_TARGET_ROOTFS_EXT2=y
+BR2_TARGET_ROOTFS_EXT2_4=y
+BR2_ROOTFS_POST_BUILD_SCRIPT="board/librecomputer/aml-s905x-cc/post-build.sh"
+BR2_ROOTFS_POST_IMAGE_SCRIPT="board/librecomputer/aml-s905x-cc/post-image.sh"
+
+# Kernel
+BR2_LINUX_KERNEL=y

Please use a fixed version of the Linux kernel.

configs/aml-s905x-cc_defconfig line 22

Quoted 10 lines
configs/aml-s905x-cc_defconfig new file +10 -0
+BR2_LINUX_KERNEL_USE_ARCH_DEFAULT_CONFIG=y
+BR2_LINUX_KERNEL_DTS_SUPPORT=y
+BR2_LINUX_KERNEL_BUILD_DEFAULT_DTS=y
+BR2_LINUX_KERNEL_USE_INTREE_DTS=y
+BR2_LINUX_KERNEL_INTREE_DTS_NAME="amlogic/meson-gxl-s905x-libretech-cc"
+BR2_LINUX_KERNEL_IMAGE=y
+BR2_LINUX_KERNEL_INSTALL_TARGET=y
+
+# U-Boot
+BR2_TARGET_UBOOT=y

Please use a fixed version of U-Boot.

Thanks!

Thomas

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

PATCH 2/2 board: Add Libre Computer AML-S905X-CC board support

Hi Thomas,

Quoted 40 lines · Thomas Petazzoni

Hello Neil,

Quoted 36 lines · Neil Armstrong
board/librecomputer/aml-s905x-cc/post-image.sh new file +36 -0
+mkdir ${BINARIES_DIR}/fip/tmp
+cp ${BINARIES_DIR}/u-boot.bin ${BINARIES_DIR}/fip/tmp/bl33.bin
+cp ${BINARIES_DIR}/fip/bl31.img ${BINARIES_DIR}/fip/tmp/bl31.img
+
+${BINARIES_DIR}/fip/blx_fix.sh ${BINARIES_DIR}/fip/bl30.bin \
+		${BINARIES_DIR}/fip/tmp/zero_tmp \
+		${BINARIES_DIR}/fip/tmp/bl30_zero.bin \
+		${BINARIES_DIR}/fip/bl301.bin \
+		${BINARIES_DIR}/fip/tmp/bl301_zero.bin \
+		${BINARIES_DIR}/fip/tmp/bl30_new.bin bl30
+
+python ${BINARIES_DIR}/fip/acs_tool.pyc ${BINARIES_DIR}/fip/bl2.bin \
+		${BINARIES_DIR}/fip/tmp/bl2_acs.bin \
+		${BINARIES_DIR}/fip/acs.bin 0
+
+${BINARIES_DIR}/fip/blx_fix.sh ${BINARIES_DIR}/fip/tmp/bl2_acs.bin \
+		${BINARIES_DIR}/fip/tmp/zero_tmp \
+		${BINARIES_DIR}/fip/tmp/bl2_zero.bin \
+		${BINARIES_DIR}/fip/bl21.bin \
+		${BINARIES_DIR}/fip/tmp/bl21_zero.bin \
+		${BINARIES_DIR}/fip/tmp/bl2_new.bin bl2
+
+${BINARIES_DIR}/fip/aml_encrypt_gxl --bl3enc \
+		--input ${BINARIES_DIR}/fip/tmp/bl30_new.bin
+
+${BINARIES_DIR}/fip/aml_encrypt_gxl --bl3enc \
+		--input ${BINARIES_DIR}/fip/tmp/bl31.img
+
+${BINARIES_DIR}/fip/aml_encrypt_gxl --bl3enc \
+		--input ${BINARIES_DIR}/fip/tmp/bl33.bin
+
+${BINARIES_DIR}/fip/aml_encrypt_gxl --bl2sig \
+		--input ${BINARIES_DIR}/fip/tmp/bl2_new.bin \
+		--output ${BINARIES_DIR}/fip/tmp/bl2.n.bin.sig
+
+${BINARIES_DIR}/fip/aml_encrypt_gxl --bootmk \
Quoted 8 lines

board/librecomputer/aml-s905x-cc/post-image.sh line 56

Quoted 5 lines
board/librecomputer/aml-s905x-cc/post-image.sh new file +5 -0
+		--output ${BINARIES_DIR}/fip/tmp/u-boot.bin \
+		--bl2 ${BINARIES_DIR}/fip/tmp/bl2.n.bin.sig \
+		--bl30 ${BINARIES_DIR}/fip/tmp/bl30_new.bin.enc \
+		--bl31 ${BINARIES_DIR}/fip/tmp/bl31.img.enc \
+		--bl33 ${BINARIES_DIR}/fip/tmp/bl33.bin.enc

Can't all this stuff be done in a script provided in the aml-s905x-cc repository ?

It should, yes.

Quoted 14 lines

board/librecomputer/aml-s905x-cc/post-image.sh line 64

Quoted 8 lines
board/librecomputer/aml-s905x-cc/post-image.sh new file +7 -0
+dd if=${BINARIES_DIR}/fip/tmp/u-boot.bin.sd.bin \
+   of=${BINARIES_DIR}/sdcard.img \
+   bs=1 count=444 conv=sync,notrunc
+
+dd if=${BINARIES_DIR}/fip/tmp/u-boot.bin.sd.bin \
+   of=${BINARIES_DIR}/sdcard.img \
+   bs=512 skip=1 seek=1 conv=fsync,notrunc

Both of these should be done using the genimage configuration file. genimage allows you to place some image data at an arbitrary offset:

For example:

Quoted 12 lines
        partition spl {
                in-partition-table = "no"
                image = "sunxi-spl.bin"
                offset = 8192
        }

        partition u-boot {
                in-partition-table = "no"
                image = "u-boot.itb"
                offset = 40K
                size = 1M # 1MB - 40K
        }

Does it support offset 0 ? We had issues with Yocto Wic not supporting offset < 512....

Quoted 11 lines

board/librecomputer/aml-s905x-cc/readme.txt line 45

Quoted 9 lines
board/librecomputer/aml-s905x-cc/readme.txt new file +7 -0
+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":

How is the eMMC visible as a block device on the build machine ?

This was copied from the Odroid-C2 README ;-)
My bas, on Odroid-C2, you can buy an adapter for eMMC for your PC... I'll remove this.

Quoted 12 lines

configs/aml-s905x-cc_defconfig line 2

Quoted 9 lines
configs/aml-s905x-cc_defconfig new file +2 -0
new file mode 100644
index 0000000..cb2550b
@@ -0,0 +1,30 @@
+# Architecture
+BR2_aarch64=y

You need something like this:

Quoted 5 lines

# Linux headers same as kernel, a 4.14 series
BR2_PACKAGE_HOST_LINUX_HEADERS_CUSTOM_4_14=y

to make sure the toolchain uses the same kernel headers version as the kernel being built.

Sure.

Quoted 6 lines

configs/aml-s905x-cc_defconfig line 5

Quoted 3 lines
configs/aml-s905x-cc_defconfig new file +2 -0
+# System
+BR2_TARGET_GENERIC_HOSTNAME="aml-s905x-cc"

Probably not needed.

Quoted 9 lines

configs/aml-s905x-cc_defconfig line 12

Quoted 7 lines
configs/aml-s905x-cc_defconfig new file +7 -0
+BR2_TARGET_ROOTFS_EXT2=y
+BR2_TARGET_ROOTFS_EXT2_4=y
+BR2_ROOTFS_POST_BUILD_SCRIPT="board/librecomputer/aml-s905x-cc/post-build.sh"
+BR2_ROOTFS_POST_IMAGE_SCRIPT="board/librecomputer/aml-s905x-cc/post-image.sh"
+
+# Kernel
+BR2_LINUX_KERNEL=y

Please use a fixed version of the Linux kernel.

Why can't it use the latest kernel ? the board is supported upstream and *should* worrk on any version.

Quoted 13 lines

configs/aml-s905x-cc_defconfig line 22

Quoted 11 lines
configs/aml-s905x-cc_defconfig new file +10 -0
+BR2_LINUX_KERNEL_USE_ARCH_DEFAULT_CONFIG=y
+BR2_LINUX_KERNEL_DTS_SUPPORT=y
+BR2_LINUX_KERNEL_BUILD_DEFAULT_DTS=y
+BR2_LINUX_KERNEL_USE_INTREE_DTS=y
+BR2_LINUX_KERNEL_INTREE_DTS_NAME="amlogic/meson-gxl-s905x-libretech-cc"
+BR2_LINUX_KERNEL_IMAGE=y
+BR2_LINUX_KERNEL_INSTALL_TARGET=y
+
+# U-Boot
+BR2_TARGET_UBOOT=y

Please use a fixed version of U-Boot.

Same as Linux, the board is supported upstream and *should* work on any version.

Quoted 5 lines

Thanks!

Thomas

Thanks,
Neil

#7 lore raw

PATCH 2/2 board: Add Libre Computer AML-S905X-CC board support

In reply to Thomas Petazzoni

Hi Thomas,

Quoted 40 lines · Thomas Petazzoni

Hello Neil,

Quoted 36 lines · Neil Armstrong
board/librecomputer/aml-s905x-cc/post-image.sh new file +36 -0
+mkdir ${BINARIES_DIR}/fip/tmp
+cp ${BINARIES_DIR}/u-boot.bin ${BINARIES_DIR}/fip/tmp/bl33.bin
+cp ${BINARIES_DIR}/fip/bl31.img ${BINARIES_DIR}/fip/tmp/bl31.img
+
+${BINARIES_DIR}/fip/blx_fix.sh ${BINARIES_DIR}/fip/bl30.bin \
+		${BINARIES_DIR}/fip/tmp/zero_tmp \
+		${BINARIES_DIR}/fip/tmp/bl30_zero.bin \
+		${BINARIES_DIR}/fip/bl301.bin \
+		${BINARIES_DIR}/fip/tmp/bl301_zero.bin \
+		${BINARIES_DIR}/fip/tmp/bl30_new.bin bl30
+
+python ${BINARIES_DIR}/fip/acs_tool.pyc ${BINARIES_DIR}/fip/bl2.bin \
+		${BINARIES_DIR}/fip/tmp/bl2_acs.bin \
+		${BINARIES_DIR}/fip/acs.bin 0
+
+${BINARIES_DIR}/fip/blx_fix.sh ${BINARIES_DIR}/fip/tmp/bl2_acs.bin \
+		${BINARIES_DIR}/fip/tmp/zero_tmp \
+		${BINARIES_DIR}/fip/tmp/bl2_zero.bin \
+		${BINARIES_DIR}/fip/bl21.bin \
+		${BINARIES_DIR}/fip/tmp/bl21_zero.bin \
+		${BINARIES_DIR}/fip/tmp/bl2_new.bin bl2
+
+${BINARIES_DIR}/fip/aml_encrypt_gxl --bl3enc \
+		--input ${BINARIES_DIR}/fip/tmp/bl30_new.bin
+
+${BINARIES_DIR}/fip/aml_encrypt_gxl --bl3enc \
+		--input ${BINARIES_DIR}/fip/tmp/bl31.img
+
+${BINARIES_DIR}/fip/aml_encrypt_gxl --bl3enc \
+		--input ${BINARIES_DIR}/fip/tmp/bl33.bin
+
+${BINARIES_DIR}/fip/aml_encrypt_gxl --bl2sig \
+		--input ${BINARIES_DIR}/fip/tmp/bl2_new.bin \
+		--output ${BINARIES_DIR}/fip/tmp/bl2.n.bin.sig
+
+${BINARIES_DIR}/fip/aml_encrypt_gxl --bootmk \
Quoted 8 lines

board/librecomputer/aml-s905x-cc/post-image.sh line 56

Quoted 5 lines
board/librecomputer/aml-s905x-cc/post-image.sh new file +5 -0
+		--output ${BINARIES_DIR}/fip/tmp/u-boot.bin \
+		--bl2 ${BINARIES_DIR}/fip/tmp/bl2.n.bin.sig \
+		--bl30 ${BINARIES_DIR}/fip/tmp/bl30_new.bin.enc \
+		--bl31 ${BINARIES_DIR}/fip/tmp/bl31.img.enc \
+		--bl33 ${BINARIES_DIR}/fip/tmp/bl33.bin.enc

Can't all this stuff be done in a script provided in the aml-s905x-cc repository ?

It should, yes.

Quoted 14 lines

board/librecomputer/aml-s905x-cc/post-image.sh line 64

Quoted 8 lines
board/librecomputer/aml-s905x-cc/post-image.sh new file +7 -0
+dd if=${BINARIES_DIR}/fip/tmp/u-boot.bin.sd.bin \
+   of=${BINARIES_DIR}/sdcard.img \
+   bs=1 count=444 conv=sync,notrunc
+
+dd if=${BINARIES_DIR}/fip/tmp/u-boot.bin.sd.bin \
+   of=${BINARIES_DIR}/sdcard.img \
+   bs=512 skip=1 seek=1 conv=fsync,notrunc

Both of these should be done using the genimage configuration file. genimage allows you to place some image data at an arbitrary offset:

For example:

Quoted 12 lines
        partition spl {
                in-partition-table = "no"
                image = "sunxi-spl.bin"
                offset = 8192
        }

        partition u-boot {
                in-partition-table = "no"
                image = "u-boot.itb"
                offset = 40K
                size = 1M # 1MB - 40K
        }

Does it support offset 0 ? We had issues with Yocto Wic not supporting offset < 512....

Quoted 11 lines

board/librecomputer/aml-s905x-cc/readme.txt line 45

Quoted 9 lines
board/librecomputer/aml-s905x-cc/readme.txt new file +7 -0
+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":

How is the eMMC visible as a block device on the build machine ?

This was copied from the Odroid-C2 README ;-)
My bas, on Odroid-C2, you can buy an adapter for eMMC for your PC... I'll remove this.

Quoted 12 lines

configs/aml-s905x-cc_defconfig line 2

Quoted 9 lines
configs/aml-s905x-cc_defconfig new file +2 -0
new file mode 100644
index 0000000..cb2550b
@@ -0,0 +1,30 @@
+# Architecture
+BR2_aarch64=y

You need something like this:

Quoted 5 lines

# Linux headers same as kernel, a 4.14 series
BR2_PACKAGE_HOST_LINUX_HEADERS_CUSTOM_4_14=y

to make sure the toolchain uses the same kernel headers version as the kernel being built.

Sure.

Quoted 6 lines

configs/aml-s905x-cc_defconfig line 5

Quoted 3 lines
configs/aml-s905x-cc_defconfig new file +2 -0
+# System
+BR2_TARGET_GENERIC_HOSTNAME="aml-s905x-cc"

Probably not needed.

Quoted 9 lines

configs/aml-s905x-cc_defconfig line 12

Quoted 7 lines
configs/aml-s905x-cc_defconfig new file +7 -0
+BR2_TARGET_ROOTFS_EXT2=y
+BR2_TARGET_ROOTFS_EXT2_4=y
+BR2_ROOTFS_POST_BUILD_SCRIPT="board/librecomputer/aml-s905x-cc/post-build.sh"
+BR2_ROOTFS_POST_IMAGE_SCRIPT="board/librecomputer/aml-s905x-cc/post-image.sh"
+
+# Kernel
+BR2_LINUX_KERNEL=y

Please use a fixed version of the Linux kernel.

Why can't it use the latest kernel ? the board is supported upstream and *should* worrk on any version.

Quoted 13 lines

configs/aml-s905x-cc_defconfig line 22

Quoted 11 lines
configs/aml-s905x-cc_defconfig new file +10 -0
+BR2_LINUX_KERNEL_USE_ARCH_DEFAULT_CONFIG=y
+BR2_LINUX_KERNEL_DTS_SUPPORT=y
+BR2_LINUX_KERNEL_BUILD_DEFAULT_DTS=y
+BR2_LINUX_KERNEL_USE_INTREE_DTS=y
+BR2_LINUX_KERNEL_INTREE_DTS_NAME="amlogic/meson-gxl-s905x-libretech-cc"
+BR2_LINUX_KERNEL_IMAGE=y
+BR2_LINUX_KERNEL_INSTALL_TARGET=y
+
+# U-Boot
+BR2_TARGET_UBOOT=y

Please use a fixed version of U-Boot.

Same as Linux, the board is supported upstream and *should* work on any version.

Quoted 5 lines

Thanks!

Thomas

Thanks,
Neil