All of lore.kernel.org
 help / color / mirror / Atom feed
* [Buildroot] [PATCH v2 0/7] Add Boundary Devices Nitrogen8M support
@ 2018-07-19 10:31 Gary Bisson
  2018-07-19 10:31 ` [Buildroot] [PATCH v2 1/7] configs/freescale_imx8mqevk: add script arg to specify U-Boot dtb Gary Bisson
                   ` (7 more replies)
  0 siblings, 8 replies; 9+ messages in thread
From: Gary Bisson @ 2018-07-19 10:31 UTC (permalink / raw)
  To: buildroot

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

-- 
2.18.0

^ permalink raw reply	[flat|nested] 9+ messages in thread

* [Buildroot] [PATCH v2 1/7] configs/freescale_imx8mqevk: add script arg to specify U-Boot dtb
  2018-07-19 10:31 [Buildroot] [PATCH v2 0/7] Add Boundary Devices Nitrogen8M support Gary Bisson
@ 2018-07-19 10:31 ` Gary Bisson
  2018-07-19 10:31 ` [Buildroot] [PATCH v2 2/7] board/freescale/common/imx: make imx8-bootloader-prepare more generic Gary Bisson
                   ` (6 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: Gary Bisson @ 2018-07-19 10:31 UTC (permalink / raw)
  To: buildroot

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

Cc: Fabio Estevam <festevam@gmail.com>
Signed-off-by: Gary Bisson <gary.bisson@boundarydevices.com>
---
 configs/freescale_imx8mqevk_defconfig | 1 +
 1 file changed, 1 insertion(+)

diff --git a/configs/freescale_imx8mqevk_defconfig b/configs/freescale_imx8mqevk_defconfig
index f48e4f78e4..a6e9b940b5 100644
--- a/configs/freescale_imx8mqevk_defconfig
+++ b/configs/freescale_imx8mqevk_defconfig
@@ -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"
-- 
2.18.0

^ permalink raw reply related	[flat|nested] 9+ messages in thread

* [Buildroot] [PATCH v2 2/7] board/freescale/common/imx: make imx8-bootloader-prepare more generic
  2018-07-19 10:31 [Buildroot] [PATCH v2 0/7] Add Boundary Devices Nitrogen8M support Gary Bisson
  2018-07-19 10:31 ` [Buildroot] [PATCH v2 1/7] configs/freescale_imx8mqevk: add script arg to specify U-Boot dtb Gary Bisson
@ 2018-07-19 10:31 ` Gary Bisson
  2018-07-19 10:31 ` [Buildroot] [PATCH v2 3/7] board/boundarydevices/common/post-build.sh: fix U-Boot naming Gary Bisson
                   ` (5 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: Gary Bisson @ 2018-07-19 10:31 UTC (permalink / raw)
  To: buildroot

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

Cc: Fabio Estevam <festevam@gmail.com>
Signed-off-by: Gary Bisson <gary.bisson@boundarydevices.com>
---
Changes in v2:
- remove fallback to evk dtb
---
 board/freescale/common/imx/imx8-bootloader-prepare.sh | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/board/freescale/common/imx/imx8-bootloader-prepare.sh b/board/freescale/common/imx/imx8-bootloader-prepare.sh
index 2648147ab0..cc12666ae6 100755
--- a/board/freescale/common/imx/imx8-bootloader-prepare.sh
+++ b/board/freescale/common/imx/imx8-bootloader-prepare.sh
@@ -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
 
-- 
2.18.0

^ permalink raw reply related	[flat|nested] 9+ messages in thread

* [Buildroot] [PATCH v2 3/7] board/boundarydevices/common/post-build.sh: fix U-Boot naming
  2018-07-19 10:31 [Buildroot] [PATCH v2 0/7] Add Boundary Devices Nitrogen8M support Gary Bisson
  2018-07-19 10:31 ` [Buildroot] [PATCH v2 1/7] configs/freescale_imx8mqevk: add script arg to specify U-Boot dtb Gary Bisson
  2018-07-19 10:31 ` [Buildroot] [PATCH v2 2/7] board/freescale/common/imx: make imx8-bootloader-prepare more generic Gary Bisson
@ 2018-07-19 10:31 ` Gary Bisson
  2018-07-19 10:31 ` [Buildroot] [PATCH v2 4/7] board/boundarydevices: remove obsolete u-boot scripts Gary Bisson
                   ` (4 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: Gary Bisson @ 2018-07-19 10:31 UTC (permalink / raw)
  To: buildroot

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

Signed-off-by: Gary Bisson <gary.bisson@boundarydevices.com>
---
 board/boundarydevices/common/post-build.sh | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/board/boundarydevices/common/post-build.sh b/board/boundarydevices/common/post-build.sh
index b8abb26540..d97c8d7b6a 100755
--- a/board/boundarydevices/common/post-build.sh
+++ b/board/boundarydevices/common/post-build.sh
@@ -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
-- 
2.18.0

^ permalink raw reply related	[flat|nested] 9+ messages in thread

* [Buildroot] [PATCH v2 4/7] board/boundarydevices: remove obsolete u-boot scripts
  2018-07-19 10:31 [Buildroot] [PATCH v2 0/7] Add Boundary Devices Nitrogen8M support Gary Bisson
                   ` (2 preceding siblings ...)
  2018-07-19 10:31 ` [Buildroot] [PATCH v2 3/7] board/boundarydevices/common/post-build.sh: fix U-Boot naming Gary Bisson
@ 2018-07-19 10:31 ` Gary Bisson
  2018-07-19 10:31 ` [Buildroot] [PATCH v2 5/7] board/boundarydevices: add i.MX8MQ support to post-build.sh Gary Bisson
                   ` (3 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: Gary Bisson @ 2018-07-19 10:31 UTC (permalink / raw)
  To: buildroot

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

Signed-off-by: Gary Bisson <gary.bisson@boundarydevices.com>
---
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

diff --git a/board/boundarydevices/common/6x_bootscript.txt b/board/boundarydevices/common/6x_bootscript.txt
deleted file mode 100644
index af5822a88b..0000000000
--- a/board/boundarydevices/common/6x_bootscript.txt
+++ /dev/null
@@ -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"
diff --git a/board/boundarydevices/common/6x_upgrade.txt b/board/boundarydevices/common/6x_upgrade.txt
deleted file mode 100644
index e012ff97ac..0000000000
--- a/board/boundarydevices/common/6x_upgrade.txt
+++ /dev/null
@@ -1,69 +0,0 @@
-if itest.s a$uboot_defconfig == a; then
-        echo "Please set uboot_defconfig to the appropriate value"
-        exit
-fi
-
-offset=0x400
-a_uImage1=0x12000000
-a_uImage2=0x12400000
-
-if itest.s x6SX == "x${cpu}" || itest.s x7D == "x${cpu}"; then
-	a_uImage1=0x82000000
-	a_uImage2=0x82400000
-fi
-
-setenv stdout serial,vga
-echo "check U-Boot" ;
-
-if load ${dtype} ${disk}:1 ${a_uImage1} u-boot.$uboot_defconfig ; then
-else
-	echo "No U-Boot image found on SD card" ;
-	exit
-fi
-echo "read $filesize bytes from SD card" ;
-if sf probe || sf probe || sf probe 1 27000000 || sf probe 1 27000000 ; then
-	echo "probed SPI ROM" ;
-else
-	echo "Error initializing EEPROM" ;
-	exit
-fi ;
-if sf read ${a_uImage2} $offset $filesize ; then
-else
-	echo "Error reading boot loader from EEPROM" ;
-	exit
-fi
-if cmp.b ${a_uImage1} ${a_uImage2} $filesize ; then
-	echo "------- U-Boot versions match" ;
-	exit
-fi
-echo "Need U-Boot upgrade" ;
-echo "Program in 5 seconds" ;
-for n in 5 4 3 2 1 ; do
-	echo $n ;
-	sleep 1 ;
-done
-echo "erasing" ;
-sf erase 0 0xC0000 ;
-
-# two steps to prevent bricking
-echo "programming" ;
-setexpr a1 ${a_uImage1} + 0x400
-setexpr o1 ${offset} + 0x400
-setexpr s1 ${filesize} - 0x400
-sf write ${a1} ${o1} ${s1} ;
-sf write ${a_uImage1} $offset 0x400 ;
-
-echo "verifying" ;
-if sf read ${a_uImage2} $offset $filesize ; then
-else
-	echo "Error re-reading EEPROM" ;
-	exit
-fi
-if cmp.b ${a_uImage1} ${a_uImage2} $filesize ; then
-else
-	echo "Read verification error" ;
-	exit
-fi
-while echo "---- U-Boot upgraded. reset" ; do
-	sleep 120
-done
diff --git a/board/boundarydevices/common/post-build.sh b/board/boundarydevices/common/post-build.sh
index d97c8d7b6a..e30efe8b88 100755
--- a/board/boundarydevices/common/post-build.sh
+++ b/board/boundarydevices/common/post-build.sh
@@ -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
-- 
2.18.0

^ permalink raw reply related	[flat|nested] 9+ messages in thread

* [Buildroot] [PATCH v2 5/7] board/boundarydevices: add i.MX8MQ support to post-build.sh
  2018-07-19 10:31 [Buildroot] [PATCH v2 0/7] Add Boundary Devices Nitrogen8M support Gary Bisson
                   ` (3 preceding siblings ...)
  2018-07-19 10:31 ` [Buildroot] [PATCH v2 4/7] board/boundarydevices: remove obsolete u-boot scripts Gary Bisson
@ 2018-07-19 10:31 ` Gary Bisson
  2018-07-19 10:31 ` [Buildroot] [PATCH v2 6/7] board/boundarydevices: add i.MX8MQ support to u-boot scripts Gary Bisson
                   ` (2 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: Gary Bisson @ 2018-07-19 10:31 UTC (permalink / raw)
  To: buildroot

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

Signed-off-by: Gary Bisson <gary.bisson@boundarydevices.com>
---
 board/boundarydevices/common/post-build.sh | 19 ++++++++++++++-----
 1 file changed, 14 insertions(+), 5 deletions(-)

diff --git a/board/boundarydevices/common/post-build.sh b/board/boundarydevices/common/post-build.sh
index e30efe8b88..161ec0643f 100755
--- a/board/boundarydevices/common/post-build.sh
+++ b/board/boundarydevices/common/post-build.sh
@@ -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
-- 
2.18.0

^ permalink raw reply related	[flat|nested] 9+ messages in thread

* [Buildroot] [PATCH v2 6/7] board/boundarydevices: add i.MX8MQ support to u-boot scripts
  2018-07-19 10:31 [Buildroot] [PATCH v2 0/7] Add Boundary Devices Nitrogen8M support Gary Bisson
                   ` (4 preceding siblings ...)
  2018-07-19 10:31 ` [Buildroot] [PATCH v2 5/7] board/boundarydevices: add i.MX8MQ support to post-build.sh Gary Bisson
@ 2018-07-19 10:31 ` Gary Bisson
  2018-07-19 10:31 ` [Buildroot] [PATCH v2 7/7] configs/nitrogen8m: Add new defconfig Gary Bisson
  2018-07-19 14:58 ` [Buildroot] [PATCH v2 0/7] Add Boundary Devices Nitrogen8M support Thomas Petazzoni
  7 siblings, 0 replies; 9+ messages in thread
From: Gary Bisson @ 2018-07-19 10:31 UTC (permalink / raw)
  To: buildroot

- 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

Signed-off-by: Gary Bisson <gary.bisson@boundarydevices.com>
---
 board/boundarydevices/common/boot.cmd    | 40 +++++++-------
 board/boundarydevices/common/upgrade.cmd | 69 +++++++++++++++++++++---
 2 files changed, 81 insertions(+), 28 deletions(-)

diff --git a/board/boundarydevices/common/boot.cmd b/board/boundarydevices/common/boot.cmd
index 7602b0139e..760363da9b 100644
--- a/board/boundarydevices/common/boot.cmd
+++ b/board/boundarydevices/common/boot.cmd
@@ -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"
diff --git a/board/boundarydevices/common/upgrade.cmd b/board/boundarydevices/common/upgrade.cmd
index 249185dba4..24b705eb76 100644
--- a/board/boundarydevices/common/upgrade.cmd
+++ b/board/boundarydevices/common/upgrade.cmd
@@ -7,6 +7,7 @@ offset=0x400
 erase_size=0xC0000
 qspi_offset=0x0
 a_base=0x12000000
+block_size=0x200
 
 if itest.s x51 == "x${imx_cpu}"; then
 	a_base=0x92000000
@@ -14,6 +15,9 @@ elif itest.s x53 == "x${imx_cpu}"; then
 	a_base=0x72000000
 elif itest.s x6SX == "x${imx_cpu}" || itest.s x7D == "x${imx_cpu}"; then
 	a_base=0x82000000
+elif itest.s x8MQ == "x${imx_cpu}"; then
+	a_base=0x42000000
+	offset=0x8400
 fi
 
 qspi_match=1
@@ -25,6 +29,54 @@ setexpr a_script ${a_base}
 
 setenv stdout serial,vga
 
+if itest.s "x${sfname}" == "x" ; then
+# U-Boot resides in (e)MMC
+if itest.s "x${env_dev}" == "x" || itest.s "x${env_part}" == "x"; then
+        echo "Please set env_dev/part to the appropriate values"
+        exit
+fi
+
+# Load bootloader binary for this board
+if ${fs}load ${devtype} ${devnum}:${distro_bootpart} ${a_uImage1} u-boot.$uboot_defconfig ; then
+else
+	echo "File u-boot.$uboot_defconfig not found on SD card" ;
+	exit
+fi
+
+# Compute block count for filesize and offset
+setexpr cntoffset ${offset} / ${block_size}
+setexpr cntfile ${filesize} / ${block_size}
+# Add 1 in case the $filesize is not a multiple of $block_size
+setexpr cntfile ${cntfile} + 1
+
+# Select media partition (if different from main partition)
+mmc dev ${env_dev} ${env_part}
+
+# Read and compare current U-Boot
+mmc read ${a_uImage2} ${cntoffset} ${cntfile}
+if cmp.b ${a_uImage1} ${a_uImage2} ${filesize} ; then
+	echo "------- U-Boot versions match" ;
+	exit ;
+fi
+
+echo "Need U-Boot upgrade" ;
+echo "Program in 5 seconds" ;
+for n in 5 4 3 2 1 ; do
+	echo $n ;
+	sleep 1 ;
+done
+mmc write ${a_uImage1} ${cntoffset} ${cntfile}
+
+# Make sure to boot from the proper partition
+if itest ${env_part} != 0 ; then
+	mmc partconf ${env_dev} 1 ${env_part} 0
+fi
+
+# Switch back to main eMMC partition (to avoid confusion)
+mmc dev ${env_dev}
+
+else
+# U-Boot resides in NOR flash
 if sf probe || sf probe || sf probe 1 27000000 || sf probe 1 27000000 ; then
 	echo "probed SPI ROM" ;
 else
@@ -32,9 +84,13 @@ else
 	exit
 fi
 
+if itest.s "x${sfname}" == "xat45db041d" ; then
+	erase_size=0x7e000
+fi
+
 if itest.s x7D == "x${imx_cpu}"; then
 	echo "check qspi parameter block" ;
-	if ${fs}load ${devtype} ${devnum}:1 ${a_qspi1} qspi-${sfname}.${uboot_defconfig} ; then
+	if ${fs}load ${devtype} ${devnum}:${distro_bootpart} ${a_qspi1} qspi-${sfname}.${uboot_defconfig} ; then
 	else
 		echo "parameter file qspi-${sfname}.${uboot_defconfig} not found on SD card"
 		exit
@@ -63,7 +119,7 @@ fi
 
 echo "check U-Boot" ;
 
-if ${fs}load ${devtype} ${devnum}:1 ${a_uImage1} u-boot.$uboot_defconfig ; then
+if ${fs}load ${devtype} ${devnum}:${distro_bootpart} ${a_uImage1} u-boot.$uboot_defconfig ; then
 else
 	echo "File u-boot.$uboot_defconfig not found on SD card" ;
 	exit
@@ -80,7 +136,7 @@ if cmp.b ${a_uImage1} ${a_uImage2} $filesize ; then
 	if itest.s "${qspi_match}" == "1" ; then
 		echo "------- upgrade not needed" ;
 		if itest.s "x" != "x${next}" ; then
-			if ${fs}load ${devtype} ${devnum}:1 ${a_script} ${next} ; then
+			if ${fs}load ${devtype} ${devnum}:${distro_bootpart} ${a_script} ${next} ; then
 				source ${a_script}
 			else
 				echo "${next} not found on SD card"
@@ -142,13 +198,14 @@ if itest.s x7D == "x${imx_cpu}"; then
 fi
 
 if itest.s "x" != "x${next}" ; then
-	if ${fs}load ${devtype} ${devnum}:1 ${a_script} ${next} ; then
+	if ${fs}load ${devtype} ${devnum}:${distro_bootpart} ${a_script} ${next} ; then
 		source ${a_script}
 	else
-		echo "${next} not found on ${devtype} ${devnum}"
+		echo "${next} not found on ${devtype} ${devnum}:${distro_bootpart}"
 	fi
 fi
+fi
 
-while echo "---- U-Boot upgraded. reset" ; do
+while echo "---- U-Boot upgraded. Please reset the board" ; do
 	sleep 120
 done
-- 
2.18.0

^ permalink raw reply related	[flat|nested] 9+ messages in thread

* [Buildroot] [PATCH v2 7/7] configs/nitrogen8m: Add new defconfig
  2018-07-19 10:31 [Buildroot] [PATCH v2 0/7] Add Boundary Devices Nitrogen8M support Gary Bisson
                   ` (5 preceding siblings ...)
  2018-07-19 10:31 ` [Buildroot] [PATCH v2 6/7] board/boundarydevices: add i.MX8MQ support to u-boot scripts Gary Bisson
@ 2018-07-19 10:31 ` Gary Bisson
  2018-07-19 14:58 ` [Buildroot] [PATCH v2 0/7] Add Boundary Devices Nitrogen8M support Thomas Petazzoni
  7 siblings, 0 replies; 9+ messages in thread
From: Gary Bisson @ 2018-07-19 10:31 UTC (permalink / raw)
  To: buildroot

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

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

Signed-off-by: Gary Bisson <gary.bisson@boundarydevices.com>
---
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

diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index 6385fffc70..ab22a1921c 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -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
diff --git a/configs/nitrogen8m_defconfig b/configs/nitrogen8m_defconfig
new file mode 100644
index 0000000000..9b758f0b97
--- /dev/null
+++ b/configs/nitrogen8m_defconfig
@@ -0,0 +1,54 @@
+# Architecture
+BR2_aarch64=y
+BR2_cortex_a53=y
+
+# System
+BR2_TARGET_GENERIC_GETTY=y
+BR2_TARGET_GENERIC_GETTY_PORT="ttymxc0"
+BR2_ROOTFS_POST_BUILD_SCRIPT="board/freescale/common/imx/imx8-bootloader-prepare.sh board/boundarydevices/common/post-build.sh"
+BR2_ROOTFS_POST_IMAGE_SCRIPT="board/boundarydevices/common/post-image.sh"
+BR2_ROOTFS_POST_SCRIPT_ARGS="${UBOOT_DIR}/arch/arm/dts/imx8mq-nitrogen8m.dtb"
+BR2_PACKAGE_HOST_GENIMAGE=y
+BR2_PACKAGE_HOST_IMX_MKIMAGE=y
+BR2_PACKAGE_HOST_UBOOT_TOOLS=y
+BR2_PACKAGE_HOST_UBOOT_TOOLS_FIT_SUPPORT=y
+
+# Filesystem
+BR2_TARGET_ROOTFS_EXT2=y
+BR2_TARGET_ROOTFS_EXT2_4=y
+
+# Linux headers same as kernel, a 4.9 series
+BR2_PACKAGE_HOST_LINUX_HEADERS_CUSTOM_4_9=y
+
+# DDR training binaries
+BR2_PACKAGE_FREESCALE_IMX=y
+BR2_PACKAGE_FREESCALE_IMX_PLATFORM_IMX8M=y
+BR2_PACKAGE_FIRMWARE_IMX=y
+
+# ARM Trusted Firmware
+BR2_TARGET_ARM_TRUSTED_FIRMWARE=y
+BR2_TARGET_ARM_TRUSTED_FIRMWARE_CUSTOM_TARBALL=y
+# Latest revision of branch boundary-imx_4.9.51_imx8m_ga
+BR2_TARGET_ARM_TRUSTED_FIRMWARE_CUSTOM_TARBALL_LOCATION="https://github.com/boundarydevices/imx-atf/archive/67c68675.tar.gz"
+BR2_TARGET_ARM_TRUSTED_FIRMWARE_PLATFORM="imx8mq"
+BR2_TARGET_ARM_TRUSTED_FIRMWARE_BL31=y
+
+# Bootloader
+BR2_TARGET_UBOOT=y
+BR2_TARGET_UBOOT_BOARD_DEFCONFIG="nitrogen8m"
+BR2_TARGET_UBOOT_BUILD_SYSTEM_KCONFIG=y
+BR2_TARGET_UBOOT_CUSTOM_TARBALL=y
+# Latest revision of branch boundary-imx_v2017.03_4.9.51_imx8m_ga
+BR2_TARGET_UBOOT_CUSTOM_TARBALL_LOCATION="https://github.com/boundarydevices/u-boot-imx6/archive/b661d854.tar.gz"
+BR2_TARGET_UBOOT_NEEDS_DTC=y
+BR2_TARGET_UBOOT_SPL=y
+
+# Kernel
+BR2_LINUX_KERNEL=y
+BR2_LINUX_KERNEL_CUSTOM_TARBALL=y
+# Latest revision  of branch boundary-imx_4.9.x_2.0.0_ga
+BR2_LINUX_KERNEL_CUSTOM_TARBALL_LOCATION="https://github.com/boundarydevices/linux-imx6/archive/7777e14d.tar.gz"
+BR2_LINUX_KERNEL_DEFCONFIG="boundary"
+BR2_LINUX_KERNEL_DTS_SUPPORT=y
+BR2_LINUX_KERNEL_INSTALL_TARGET=y
+BR2_LINUX_KERNEL_INTREE_DTS_NAME="freescale/imx8mq-nitrogen8m freescale/imx8mq-nitrogen8m-m4"
-- 
2.18.0

^ permalink raw reply related	[flat|nested] 9+ messages in thread

* [Buildroot] [PATCH v2 0/7] Add Boundary Devices Nitrogen8M support
  2018-07-19 10:31 [Buildroot] [PATCH v2 0/7] Add Boundary Devices Nitrogen8M support Gary Bisson
                   ` (6 preceding siblings ...)
  2018-07-19 10:31 ` [Buildroot] [PATCH v2 7/7] configs/nitrogen8m: Add new defconfig Gary Bisson
@ 2018-07-19 14:58 ` Thomas Petazzoni
  7 siblings, 0 replies; 9+ messages in thread
From: Thomas Petazzoni @ 2018-07-19 14:58 UTC (permalink / raw)
  To: buildroot

Hello,

On Thu, 19 Jul 2018 12:31:02 +0200, Gary Bisson wrote:

> 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.

>   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
-- 
Thomas Petazzoni, CTO, Bootlin (formerly Free Electrons)
Embedded Linux and Kernel engineering
https://bootlin.com

^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2018-07-19 14:58 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-07-19 10:31 [Buildroot] [PATCH v2 0/7] Add Boundary Devices Nitrogen8M support Gary Bisson
2018-07-19 10:31 ` [Buildroot] [PATCH v2 1/7] configs/freescale_imx8mqevk: add script arg to specify U-Boot dtb Gary Bisson
2018-07-19 10:31 ` [Buildroot] [PATCH v2 2/7] board/freescale/common/imx: make imx8-bootloader-prepare more generic Gary Bisson
2018-07-19 10:31 ` [Buildroot] [PATCH v2 3/7] board/boundarydevices/common/post-build.sh: fix U-Boot naming Gary Bisson
2018-07-19 10:31 ` [Buildroot] [PATCH v2 4/7] board/boundarydevices: remove obsolete u-boot scripts Gary Bisson
2018-07-19 10:31 ` [Buildroot] [PATCH v2 5/7] board/boundarydevices: add i.MX8MQ support to post-build.sh Gary Bisson
2018-07-19 10:31 ` [Buildroot] [PATCH v2 6/7] board/boundarydevices: add i.MX8MQ support to u-boot scripts Gary Bisson
2018-07-19 10:31 ` [Buildroot] [PATCH v2 7/7] configs/nitrogen8m: Add new defconfig Gary Bisson
2018-07-19 14:58 ` [Buildroot] [PATCH v2 0/7] Add Boundary Devices Nitrogen8M support Thomas Petazzoni

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.