Skip to contentSkip to conversation

Add Boundary Devices Nitrogen8M support

PATCH New Gary Bisson 2 participants 9 messages Jul 19, 2018 Arm i.MX and Layerscape

lore
Share & tools
lore
#0 lore raw

v2 cover Add Boundary Devices Nitrogen8M support

Hi all,

This series adds support for our i.MX8MQ based Nitrogen8M platform.

Since this is our first ARM64 design, our boot scripts and post-build script needed to be updated. Doing so, it became clear that it was time to remove obsolete boot scripts so it is part of the series as well.

Also, the freescale imx8-bootloader-prepare script hardcoded the evk device tree which means it could only be used for 1 board. Therefore it was also modified to accept any device tree as a script argument (using BR2_ROOTFS_POST_SCRIPT_ARGS).

Changes in v2:
- Add script parameter to evk defconfig to specify dtb
- Remove fallback to evk dtb in imx8-bootloader-prepare
- Split post-build.sh patch
- Add missing .gitlab-ci.yml reference to nitrogen8m_defconfig

Regards,
Gary

Gary Bisson (7):
configs/freescale_imx8mqevk: add script arg to specify U-Boot dtb board/freescale/common/imx: make imx8-bootloader-prepare more generic board/boundarydevices/common/post-build.sh: fix U-Boot naming board/boundarydevices: remove obsolete u-boot scripts board/boundarydevices: add i.MX8MQ support to post-build.sh board/boundarydevices: add i.MX8MQ support to u-boot scripts configs/nitrogen8m: Add new defconfig

 .gitlab-ci.yml                                |   1 +
 .../boundarydevices/common/6x_bootscript.txt  | 131 ------------------
 board/boundarydevices/common/6x_upgrade.txt   |  69 ---------
 board/boundarydevices/common/boot.cmd         |  40 +++---
 board/boundarydevices/common/post-build.sh    |  28 ++--
 board/boundarydevices/common/upgrade.cmd      |  69 ++++++++-
 .../common/imx/imx8-bootloader-prepare.sh     |   8 +-
 configs/freescale_imx8mqevk_defconfig         |   1 +
 configs/nitrogen8m_defconfig                  |  54 ++++++++
 9 files changed, 159 insertions(+), 242 deletions(-)
 delete mode 100644 board/boundarydevices/common/6x_bootscript.txt
 delete mode 100644 board/boundarydevices/common/6x_upgrade.txt
 create mode 100644 configs/nitrogen8m_defconfig
Signature · 1 line
2.18.0
#1 lore raw

PATCH v2 1/7 configs/freescale_imx8mqevk: add script arg to specify U-Boot dtb

This change will allow to have a more generic imx8-bootloader-prepare.sh script which doesn't hadcode any dtb name/location.

---
 configs/freescale_imx8mqevk_defconfig | 1 +
 1 file changed, 1 insertion(+)
configs/freescale_imx8mqevk_defconfig +1 -0
index f48e4f78e4..a6e9b940b5 100644
@@ -3,6 +3,7 @@ BR2_ARM_FPU_VFPV3=y
 BR2_PACKAGE_HOST_LINUX_HEADERS_CUSTOM_4_9=y
 BR2_TARGET_GENERIC_GETTY_PORT="ttymxc0"
 BR2_ROOTFS_POST_IMAGE_SCRIPT="board/freescale/common/imx/imx8-bootloader-prepare.sh board/freescale/common/imx/post-image.sh"
+BR2_ROOTFS_POST_SCRIPT_ARGS="${UBOOT_DIR}/arch/arm/dts/fsl-imx8mq-evk.dtb"
 BR2_LINUX_KERNEL=y
 BR2_LINUX_KERNEL_CUSTOM_GIT=y
 BR2_LINUX_KERNEL_CUSTOM_REPO_URL="https://source.codeaurora.org/external/imx/linux-imx"
Signature · 1 line
2.18.0
#2 lore raw

PATCH v2 2/7 board/freescale/common/imx: make imx8-bootloader-prepare more generic

In reply to Gary Bisson

Allow user to override the hardcoded dtb name by using BR2_ROOTFS_POST_SCRIPT_ARGS.

---
Changes in v2:
- remove fallback to evk dtb

---
 board/freescale/common/imx/imx8-bootloader-prepare.sh | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)
board/freescale/common/imx/imx8-bootloader-prepare.sh +6 -2
index 2648147ab0..cc12666ae6 100755
@@ -2,9 +2,13 @@
 
 main ()
 {
-	# Currently we support imx8mqevk.
+	UBOOT_DTB=$2
+	if [ ! -e "$UBOOT_DTB" ]; then
+		echo "ERROR: couldn't find dtb: $UBOOT_DTB"
+		exit 1
+	fi
 	cat ${BINARIES_DIR}/u-boot-spl.bin ${BINARIES_DIR}/lpddr4_pmu_train_fw.bin > ${BINARIES_DIR}/u-boot-spl-ddr.bin
-	BL31=${BINARIES_DIR}/bl31.bin BL33=${BINARIES_DIR}/u-boot.bin ${HOST_DIR}/bin/mkimage_fit_atf.sh ${BINARIES_DIR}/fsl-imx8mq-evk.dtb > ${BINARIES_DIR}/u-boot.its
+	BL31=${BINARIES_DIR}/bl31.bin BL33=${BINARIES_DIR}/u-boot.bin ${HOST_DIR}/bin/mkimage_fit_atf.sh ${UBOOT_DTB} > ${BINARIES_DIR}/u-boot.its
 	${HOST_DIR}/bin/mkimage -E -p 0x3000 -f ${BINARIES_DIR}/u-boot.its ${BINARIES_DIR}/u-boot.itb
 	rm -f ${BINARIES_DIR}/u-boot.its
 
Signature · 1 line
2.18.0
#3 lore raw

PATCH v2 3/7 board/boundarydevices/common/post-build.sh: fix U-Boot naming

In reply to Gary Bisson

The upgrade.cmd script expects the binary to be named u-boot.<uboot_defconfig>.

---
 board/boundarydevices/common/post-build.sh | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)
board/boundarydevices/common/post-build.sh +4 -3
index b8abb26540..d97c8d7b6a 100755
@@ -6,6 +6,7 @@
 #
 
 BOARD_DIR="$(dirname $0)"
+UBOOT_DEFCONFIG="$(grep BR2_TARGET_UBOOT_BOARD_DEFCONFIG ${BR2_CONFIG} | sed 's/.*\"\(.*\)\"/\1/')"
 
 # bd u-boot looks for standard bootscript
 install -m 0644 -D $BINARIES_DIR/boot.scr $TARGET_DIR/boot/
@@ -14,9 +15,9 @@ $HOST_DIR/bin/mkimage -A arm -O linux -T script -C none -a 0 -e 0 \
 -n "boot script" -d $BOARD_DIR/6x_bootscript.txt $TARGET_DIR/6x_bootscript
 
 # u-boot / update script for bd upgradeu command
-if [ -e $BINARIES_DIR/u-boot.imx ];
-then
-    install -D -m 0644 $BINARIES_DIR/u-boot.imx $TARGET_DIR/u-boot.imx
+if [ -e $BINARIES_DIR/u-boot.imx ]; then
+    install -D -m 0644 $BINARIES_DIR/u-boot.imx \
+        $TARGET_DIR/u-boot.$UBOOT_DEFCONFIG
     $HOST_DIR/bin/mkimage -A arm -O linux -T script -C none -a 0 -e 0 \
     -n "upgrade script" -d $BOARD_DIR/upgrade.cmd $TARGET_DIR/upgrade.scr
     # legacy 6x_upgrade script
Signature · 1 line
2.18.0
#4 lore raw

PATCH v2 4/7 board/boundarydevices: remove obsolete u-boot scripts

In reply to Gary Bisson

6x_bootscript/6x_upgrade have been deprecated for more than a year.

---
Changes in v2:
- include post-build.sh modifications in the same patch

---
 .../boundarydevices/common/6x_bootscript.txt  | 131 ------------------
 board/boundarydevices/common/6x_upgrade.txt   |  69 ---------
 board/boundarydevices/common/post-build.sh    |   6 -
 3 files changed, 206 deletions(-)
 delete mode 100644 board/boundarydevices/common/6x_bootscript.txt
 delete mode 100644 board/boundarydevices/common/6x_upgrade.txt
board/boundarydevices/common/6x_bootscript.txt deleted +0 -131
deleted file mode 100644
index af5822a88b..0000000000
@@ -1,131 +0,0 @@
-setenv bootargs ''
-
-if itest.s x6SX == "x${cpu}" || itest.s x7D == "x${cpu}"; then
-	a_script=0x80800000
-	a_zImage=0x80800000
-	a_fdt=0x83000000
-	m4=''
-	if itest.s "x1" == "x$m4enabled" ; then
-		run m4boot;
-		m4='-m4';
-	fi
-else
-	a_script=0x10800000
-	a_zImage=0x10800000
-	a_fdt=0x13000000
-fi
-
-setenv initrd_high 0xffffffff
-if itest.s "x" == "x${dtbname}" ; then
-	if itest.s x6SOLO == "x${cpu}" ; then
-		dtbname=imx6dl-${board}.dtb;
-	elif itest.s x6DL == "x${cpu}" ; then
-		dtbname=imx6dl-${board}.dtb;
-	elif itest.s x6QP == "x${cpu}" ; then
-		dtbname=imx6qp-${board}.dtb;
-	elif itest.s x6SX == "x${cpu}" ; then
-		dtbname=imx6sx-${board}${m4}.dtb;
-	elif itest.s x7D == "x${cpu}" ; then
-		dtbname=imx7d-${board}${m4}.dtb;
-	else
-		dtbname=imx6q-${board}.dtb;
-	fi
-fi
-
-if load ${dtype} ${disk}:1 ${a_script} uEnv.txt ; then
-    env import -t ${a_script} ${filesize}
-fi
-
-if itest.s x == x${bootdir} ; then
-	bootdir=/boot/
-fi
-
-if itest.s x${bootpart} == x ; then
-	bootpart=1
-fi
-
-if load ${dtype} ${disk}:${bootpart} ${a_fdt} ${bootdir}${dtbname} ; then
-	fdt addr ${a_fdt}
-	setenv fdt_high 0xffffffff
-else
-	echo "!!!! Error loading ${bootdir}${dtbname}";
-	exit;
-fi
-
-cmd_xxx_present=
-fdt resize
-if itest.s "x" != "x${cmd_custom}" ; then
-	run cmd_custom
-	cmd_xxx_present=1;
-fi
-
-if itest.s "x" != "x${cmd_hdmi}" ; then
-	run cmd_hdmi
-	cmd_xxx_present=1;
-	if itest.s x == x${allow_noncea} ; then
-		setenv bootargs ${bootargs} mxc_hdmi.only_cea=1;
-		echo "only CEA modes allowed on HDMI port";
-	else
-		setenv bootargs ${bootargs} mxc_hdmi.only_cea=0;
-		echo "non-CEA modes allowed on HDMI, audio may be affected";
-	fi
-fi
-
-if itest.s "x" != "x${cmd_lcd}" ; then
-	run cmd_lcd
-	cmd_xxx_present=1;
-fi
-if itest.s "x" != "x${cmd_lvds}" ; then
-	run cmd_lvds
-	cmd_xxx_present=1;
-fi
-if itest.s "x" != "x${cmd_lvds2}" ; then
-	run cmd_lvds2
-	cmd_xxx_present=1;
-fi
-
-if itest.s "x" == "x${cmd_xxx_present}" ; then
-	echo "!!!!!!!!!!!!!!!!"
-	echo "warning: your u-boot may be outdated, please upgrade"
-	echo "!!!!!!!!!!!!!!!!"
-fi
-
-setenv bootargs "${bootargs} console=${console},115200 vmalloc=400M consoleblank=0 rootwait fixrtc"
-
-if test "sata" = "${dtype}" ; then
-	setenv bootargs "${bootargs} root=/dev/sda${bootpart}" ;
-elif test "usb" = "${dtype}" ; then
-	setenv bootargs "${bootargs} root=/dev/sda${bootpart}" ;
-else
-	setenv bootargs "${bootargs} root=/dev/mmcblk${disk}p${bootpart}"
-fi
-
-if itest.s "x" != "x${disable_giga}" ; then
-	setenv bootargs ${bootargs} fec.disable_giga=1
-fi
-
-if itest.s "x" != "x${wlmac}" ; then
-	setenv bootargs ${bootargs} wlcore.mac=${wlmac}
-	setenv bootargs ${bootargs} wlan.mac=${wlmac}
-fi
-
-if itest.s "x" != "x${gpumem}" ; then
-	setenv bootargs ${bootargs} galcore.contiguousSize=${gpumem}
-fi
-
-if itest.s "x" != "x${cma}" ; then
-	setenv bootargs ${bootargs} cma=${cma}
-fi
-
-if itest.s "x" != "x${show_fdt}" ; then
-	fdt print /
-fi
-
-if itest.s "x" != "x${show_env}" ; then
-	printenv
-fi
-
-if load ${dtype} ${disk}:${bootpart} ${a_zImage} ${bootdir}/zImage ; then
-	bootz ${a_zImage} - ${a_fdt}
-fi
-echo "Error loading kernel image"
board/boundarydevices/common/6x_upgrade.txt deleted +0 -69

69 lines not on this page · raw message

board/boundarydevices/common/post-build.sh +0 -6
index d97c8d7b6a..e30efe8b88 100755
@@ -10,9 +10,6 @@ UBOOT_DEFCONFIG="$(grep BR2_TARGET_UBOOT_BOARD_DEFCONFIG ${BR2_CONFIG} | sed 's/
 
 # bd u-boot looks for standard bootscript
 install -m 0644 -D $BINARIES_DIR/boot.scr $TARGET_DIR/boot/
-# legacy 6x_bootscript script
-$HOST_DIR/bin/mkimage -A arm -O linux -T script -C none -a 0 -e 0 \
--n "boot script" -d $BOARD_DIR/6x_bootscript.txt $TARGET_DIR/6x_bootscript
 
 # u-boot / update script for bd upgradeu command
 if [ -e $BINARIES_DIR/u-boot.imx ]; then
@@ -20,7 +17,4 @@ if [ -e $BINARIES_DIR/u-boot.imx ]; then
         $TARGET_DIR/u-boot.$UBOOT_DEFCONFIG
     $HOST_DIR/bin/mkimage -A arm -O linux -T script -C none -a 0 -e 0 \
     -n "upgrade script" -d $BOARD_DIR/upgrade.cmd $TARGET_DIR/upgrade.scr
-    # legacy 6x_upgrade script
-    $HOST_DIR/bin/mkimage -A arm -O linux -T script -C none -a 0 -e 0 \
-    -n "upgrade script" -d $BOARD_DIR/6x_upgrade.txt $TARGET_DIR/6x_upgrade
 fi
Signature · 1 line
2.18.0
#5 lore raw

PATCH v2 5/7 board/boundarydevices: add i.MX8MQ support to post-build.sh

In reply to Gary Bisson

- Use proper ARCH for mkimage command
- Use differente U-Boot binary name depending on ARCH

---
 board/boundarydevices/common/post-build.sh | 19 ++++++++++++++-----
 1 file changed, 14 insertions(+), 5 deletions(-)
board/boundarydevices/common/post-build.sh +14 -5
index e30efe8b88..161ec0643f 100755
@@ -8,13 +8,22 @@
 BOARD_DIR="$(dirname $0)"
 UBOOT_DEFCONFIG="$(grep BR2_TARGET_UBOOT_BOARD_DEFCONFIG ${BR2_CONFIG} | sed 's/.*\"\(.*\)\"/\1/')"
 
+if grep -Eq "^BR2_aarch64=y$" ${BR2_CONFIG}; then
+	MKIMAGE_ARCH=arm64
+	UBOOT_BINARY=imx8-boot-sd.bin
+else
+	MKIMAGE_ARCH=arm
+	UBOOT_BINARY=u-boot.imx
+fi
+
 # bd u-boot looks for standard bootscript
-install -m 0644 -D $BINARIES_DIR/boot.scr $TARGET_DIR/boot/
+$HOST_DIR/bin/mkimage -A $MKIMAGE_ARCH -O linux -T script -C none -a 0 -e 0 \
+    -n "boot script" -d $BOARD_DIR/boot.cmd $TARGET_DIR/boot/boot.scr
 
 # u-boot / update script for bd upgradeu command
-if [ -e $BINARIES_DIR/u-boot.imx ]; then
-    install -D -m 0644 $BINARIES_DIR/u-boot.imx \
+if [ -e $BINARIES_DIR/$UBOOT_BINARY ]; then
+    install -D -m 0644 $BINARIES_DIR/$UBOOT_BINARY \
         $TARGET_DIR/u-boot.$UBOOT_DEFCONFIG
-    $HOST_DIR/bin/mkimage -A arm -O linux -T script -C none -a 0 -e 0 \
-    -n "upgrade script" -d $BOARD_DIR/upgrade.cmd $TARGET_DIR/upgrade.scr
+    $HOST_DIR/bin/mkimage -A $MKIMAGE_ARCH -O linux -T script -C none -a 0 -e 0 \
+        -n "upgrade script" -d $BOARD_DIR/upgrade.cmd $TARGET_DIR/upgrade.scr
 fi
Signature · 1 line
2.18.0
#6 lore raw

PATCH v2 6/7 board/boundarydevices: add i.MX8MQ support to u-boot scripts

In reply to Gary Bisson

- Update RAM address
- Update kernel image name for ARM64
- Update U-Boot boot command for ARM64
- Remove obsolete cmd_xxx_present check
- Remove obsolete wlan.mac parameter
- Add cmd_mipi command for MIPI-DSI interface

---
 board/boundarydevices/common/boot.cmd    | 40 +++++++-------
 board/boundarydevices/common/upgrade.cmd | 69 +++++++++++++++++++++---
 2 files changed, 81 insertions(+), 28 deletions(-)
board/boundarydevices/common/boot.cmd +18 -22
index 7602b0139e..760363da9b 100644
@@ -2,6 +2,8 @@ setenv bootargs ''
 
 setenv initrd_high 0xffffffff
 m4=''
+kernelimage=zImage
+bootcommand=bootz
 a_base=0x10000000
 if itest.s x51 == "x${imx_cpu}" ; then
 	a_base=0x90000000
@@ -9,10 +11,14 @@ elif itest.s x53 == "x${imx_cpu}"; then
 	a_base=0x70000000
 elif itest.s x6SX == "x${imx_cpu}" || itest.s x7D == "x${imx_cpu}"; then
 	a_base=0x80000000
-	if itest.s "x1" == "x$m4enabled" ; then
-		run m4boot;
-		m4='-m4';
-	fi
+elif itest.s x8MQ == "x${imx_cpu}"; then
+	a_base=0x40000000
+	kernelimage=Image
+	bootcommand=booti
+fi
+if itest.s "x1" == "x${m4enabled}" ; then
+	run m4boot;
+	m4='-m4';
 fi
 
 setexpr a_script  ${a_base} + 0x00800000
@@ -39,10 +45,12 @@ if itest.s "x" == "x${fdt_file}" ; then
 		fdt_file=imx6sx-${board}${m4}.dtb;
 	elif itest.s x7D == "x${imx_cpu}" ; then
 		fdt_file=imx7d-${board}${m4}.dtb;
+	elif itest.s x8MQ == "x${imx_cpu}" ; then
+		fdt_file=imx8mq-${board}${m4}.dtb;
 	elif itest.s x51 == "x${imx_cpu}" ; then
-		fdt_file=imx51-${board}${m4}.dtb;
+		fdt_file=imx51-${board}.dtb;
 	elif itest.s x53 == "x${imx_cpu}" ; then
-		fdt_file=imx53-${board}${m4}.dtb;
+		fdt_file=imx53-${board}.dtb;
 	else
 		fdt_file=imx6q-${board}.dtb;
 	fi
@@ -66,16 +74,12 @@ else
 	exit;
 fi
 
-cmd_xxx_present=
 fdt resize
 if itest.s "x" != "x${cmd_custom}" ; then
 	run cmd_custom
-	cmd_xxx_present=1;
 fi
-
 if itest.s "x" != "x${cmd_hdmi}" ; then
 	run cmd_hdmi
-	cmd_xxx_present=1;
 	if itest.s x == x${allow_noncea} ; then
 		setenv bootargs ${bootargs} mxc_hdmi.only_cea=1;
 		echo "only CEA modes allowed on HDMI port";
@@ -87,25 +91,18 @@ fi
 
 if itest.s "x" != "x${cmd_lcd}" ; then
 	run cmd_lcd
-	cmd_xxx_present=1;
 fi
 if itest.s "x" != "x${cmd_lcd2}" ; then
 	run cmd_lcd2
-	cmd_xxx_present=1;
 fi
 if itest.s "x" != "x${cmd_lvds}" ; then
 	run cmd_lvds
-	cmd_xxx_present=1;
 fi
 if itest.s "x" != "x${cmd_lvds2}" ; then
 	run cmd_lvds2
-	cmd_xxx_present=1;
 fi
-
-if itest.s "x" == "x${cmd_xxx_present}" ; then
-	echo "!!!!!!!!!!!!!!!!"
-	echo "warning: your u-boot may be outdated, please upgrade"
-	echo "!!!!!!!!!!!!!!!!"
+if itest.s "x" != "x${cmd_mipi}" ; then
+	run cmd_mipi
 fi
 
 if test "sata" = "${devtype}" ; then
@@ -126,7 +123,6 @@ fi
 
 if itest.s "x" != "x${wlmac}" ; then
 	setenv bootargs ${bootargs} wlcore.mac=${wlmac}
-	setenv bootargs ${bootargs} wlan.mac=${wlmac}
 fi
 
 if itest.s "x" != "x${gpumem}" ; then
@@ -149,7 +145,7 @@ if itest.s "x" != "x${show_env}" ; then
 	printenv
 fi
 
-if load ${devtype} ${devnum}:${distro_bootpart} ${a_zImage} ${prefix}zImage ; then
-	bootz ${a_zImage} - ${a_fdt}
+if load ${devtype} ${devnum}:${distro_bootpart} ${a_zImage} ${prefix}${kernelimage} ; then
+	${bootcommand} ${a_zImage} - ${a_fdt}
 fi
 echo "Error loading kernel image"
board/boundarydevices/common/upgrade.cmd +63 -6

117 lines not on this page · raw message

Signature · 1 line
2.18.0
#7 lore raw

PATCH v2 7/7 configs/nitrogen8m: Add new defconfig

In reply to Gary Bisson

NXP i.MX8MQ based SBC with 2GB of LPDDR4 and 8GB eMMC.

More details on the platform here:
https://boundarydevices.com/product/nitrogen8m

---
Changes in v2:
- Add missing .gitlab-ci.yml reference to Nitrogen8M

---
 .gitlab-ci.yml               |  1 +
 configs/nitrogen8m_defconfig | 54 ++++++++++++++++++++++++++++++++++++
 2 files changed, 55 insertions(+)
 create mode 100644 configs/nitrogen8m_defconfig
.gitlab-ci.yml +1 -0
index 6385fffc70..ab22a1921c 100644
@@ -166,6 +166,7 @@ nexbox_a95x_defconfig: *defconfig
 nitrogen6sx_defconfig: *defconfig
 nitrogen6x_defconfig: *defconfig
 nitrogen7_defconfig: *defconfig
+nitrogen8m_defconfig: *defconfig
 odroidc2_defconfig: *defconfig
 olimex_a10_olinuxino_lime_defconfig: *defconfig
 olimex_a13_olinuxino_defconfig: *defconfig
configs/nitrogen8m_defconfig new file +54 -0

54 lines not on this page · raw message

Signature · 1 line
2.18.0
#8 lore raw

v2 cover Add Boundary Devices Nitrogen8M support

In reply to Gary Bisson

Hello,

Quoted 3 lines · Gary Bisson

Gary Bisson (7):
configs/freescale_imx8mqevk: add script arg to specify U-Boot dtb board/freescale/common/imx: make imx8-bootloader-prepare more generic

These two patches are really the same logical change, so I squashed them.

Quoted 5 lines

board/boundarydevices/common/post-build.sh: fix U-Boot naming board/boundarydevices: remove obsolete u-boot scripts board/boundarydevices: add i.MX8MQ support to post-build.sh board/boundarydevices: add i.MX8MQ support to u-boot scripts configs/nitrogen8m: Add new defconfig

Entire series applied. Thanks for the quick respin taking into account my comments!

Best regards,

Thomas

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